diff --git a/includes/data-stores/class-wc-customer-download-data-store.php b/includes/data-stores/class-wc-customer-download-data-store.php index 951e50bd61a..f2a6e4851ff 100644 --- a/includes/data-stores/class-wc-customer-download-data-store.php +++ b/includes/data-stores/class-wc-customer-download-data-store.php @@ -225,6 +225,23 @@ class WC_Customer_Download_Data_Store implements WC_Customer_Download_Data_Store ); } + /** + * Method to delete a download permission from the database by user ID. + * + * @since 3.4.0 + * @param int $id user ID of the downloads that will be deleted. + */ + public function delete_by_user_id( $id ) { + global $wpdb; + $wpdb->query( + $wpdb->prepare( + "DELETE FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions + WHERE user_id = %d", + $id + ) + ); + } + /** * Get a download object. *