WC_Customer_Download_Data_Store::delete_by_user_email()publicWC 3.4.0

Method to delete a download permission from the database by user email.

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_email( $email );
$email(string) (required)
email of the downloads that will be deleted.

Changelog

Since 3.4.0 Introduced.

WC_Customer_Download_Data_Store::delete_by_user_email() code WC 8.6.1

public function delete_by_user_email( $email ) {
	global $wpdb;
	// Delete related records in wc_download_log (aka ON DELETE CASCADE).
	$this->delete_download_log_by_field_value( 'user_email', $email );

	return (bool) $wpdb->query(
		$wpdb->prepare(
			"DELETE FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions
			WHERE user_email = %s",
			$email
		)
	);
}