WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Privacy_Erasers::customer_tokens_eraser() public WC 3.4.0

Finds and erases customer tokens by email address.

Это метод класса: WC_Privacy_Erasers{}

Возвращает

Массив. An array of personal data in name value pairs

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

$result = WC_Privacy_Erasers::customer_tokens_eraser( $email_address, $page );
$email_address(строка) (обязательный)
The user email address.
$page(число) (обязательный)
Page.

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

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

Код WC_Privacy_Erasers::customer_tokens_eraser() WC 4.5.2

woocommerce/includes/class-wc-privacy-erasers.php
<?php
public static function customer_tokens_eraser( $email_address, $page ) {
	$response = array(
		'items_removed'  => false,
		'items_retained' => false,
		'messages'       => array(),
		'done'           => true,
	);

	$user = get_user_by( 'email', $email_address ); // Check if user has an ID in the DB to load stored personal data.

	if ( ! $user instanceof WP_User ) {
		return $response;
	}

	$tokens = WC_Payment_Tokens::get_tokens(
		array(
			'user_id' => $user->ID,
		)
	);

	if ( empty( $tokens ) ) {
		return $response;
	}

	foreach ( $tokens as $token ) {
		WC_Payment_Tokens::delete( $token->get_id() );

		/* Translators: %s Prop name. */
		$response['messages'][]    = sprintf( __( 'Removed payment token "%d"', 'woocommerce' ), $token->get_id() );
		$response['items_removed'] = true;
	}

	/**
	 * Allow extensions to remove data for tokens and adjust the response.
	 *
	 * @since 3.4.0
	 * @param array $response Array resonse data. Must include messages, num_items_removed, num_items_retained, done.
	 * @param array $tokens   Array of tokens.
	 */
	return apply_filters( 'woocommerce_privacy_erase_personal_data_tokens', $response, $tokens );
}