delete_by_user_id method for customer downloads

This commit is contained in:
Mike Jolley 2018-04-13 15:07:58 +01:00
parent 53a93fd3b1
commit 3f2d8e8eef
1 changed files with 17 additions and 0 deletions

View File

@ -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.
*