WC_Customer_Download_Data_Store::delete_by_user_id()publicWC 3.4.0

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

Метод класса: WC_Customer_Download_Data_Store{}

Хуков нет.

Возвращает

true|false. True if deleted rows.

Использование

$WC_Customer_Download_Data_Store = new WC_Customer_Download_Data_Store();
$WC_Customer_Download_Data_Store->delete_by_user_id( $id );
$id(int) (обязательный)
user ID of the downloads that will be deleted.

Список изменений

С версии 3.4.0 Введена.

Код WC_Customer_Download_Data_Store::delete_by_user_id() WC 7.3.0

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
		)
	);
}