WC_Customer_Download_Data_Store::delete_by_user_id()
Method to delete a download permission from the database by user ID.
Method of the class: WC_Customer_Download_Data_Store{}
No Hooks.
Return
true|false
. True if deleted rows.
Usage
$WC_Customer_Download_Data_Store = new WC_Customer_Download_Data_Store(); $WC_Customer_Download_Data_Store->delete_by_user_id( $id );
- $id(int) (required)
- user ID of the downloads that will be deleted.
Changelog
Since 3.4.0 | Introduced. |
WC_Customer_Download_Data_Store::delete_by_user_id() WC Customer Download Data Store::delete by user id code WC 9.4.2
public function delete_by_user_id( $id ) { global $wpdb; // Delete related records in wc_download_log (aka ON DELETE CASCADE). $this->delete_download_log_by_field_value( 'user_id', $id ); return (bool) $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions WHERE user_id = %d", $id ) ); }