WC_Privacy_Erasers::download_data_eraser()
Finds and removes customer download logs by email address.
Метод класса: WC_Privacy_Erasers{}
Хуки из метода
Возвращает
Массив
. An array of personal data in name value pairs
Использование
$result = WC_Privacy_Erasers::download_data_eraser( $email_address, $page );
- $email_address(строка) (обязательный)
- The user email address.
- $page(int) (обязательный)
- Page.
Список изменений
С версии 3.4.0 | Введена. |
Код WC_Privacy_Erasers::download_data_eraser() WC Privacy Erasers::download data eraser WC 9.4.2
public static function download_data_eraser( $email_address, $page ) { $page = (int) $page; $user = get_user_by( 'email', $email_address ); // Check if user has an ID in the DB to load stored personal data. $erasure_enabled = wc_string_to_bool( get_option( 'woocommerce_erasure_request_removes_download_data', 'no' ) ); $response = array( 'items_removed' => false, 'items_retained' => false, 'messages' => array(), 'done' => true, ); $downloads_query = array( 'limit' => -1, 'page' => $page, 'return' => 'ids', ); if ( $user instanceof WP_User ) { $downloads_query['user_id'] = (int) $user->ID; } else { $downloads_query['user_email'] = $email_address; } $customer_download_data_store = WC_Data_Store::load( 'customer-download' ); // Revoke download permissions. if ( apply_filters( 'woocommerce_privacy_erase_download_personal_data', $erasure_enabled, $email_address ) ) { if ( $user instanceof WP_User ) { $result = $customer_download_data_store->delete_by_user_id( (int) $user->ID ); } else { $result = $customer_download_data_store->delete_by_user_email( $email_address ); } if ( $result ) { $response['messages'][] = __( 'Removed access to downloadable files.', 'woocommerce' ); $response['items_removed'] = true; } } else { $response['messages'][] = __( 'Customer download permissions have been retained.', 'woocommerce' ); $response['items_retained'] = true; } return $response; }