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

WP_Application_Passwords::record_application_password_usage() public WP 5.6.0

Records that an application password has been used.

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

Хуков нет.

Возвращает

true|WP_Error. True if the usage was recorded, a WP_Error if an error occurs.

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

$result = WP_Application_Passwords::record_application_password_usage( $user_id, $uuid );
$user_id(int) (обязательный)
User ID.
$uuid(строка) (обязательный)
The password's uuid.

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

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

Код WP_Application_Passwords::record_application_password_usage() WP 5.8

<?php
public static function record_application_password_usage( $user_id, $uuid ) {
	$passwords = static::get_user_application_passwords( $user_id );

	foreach ( $passwords as &$password ) {
		if ( $password['uuid'] !== $uuid ) {
			continue;
		}

		// Only record activity once a day.
		if ( $password['last_used'] + DAY_IN_SECONDS > time() ) {
			return true;
		}

		$password['last_used'] = time();
		$password['last_ip']   = $_SERVER['REMOTE_ADDR'];

		$saved = static::set_user_application_passwords( $user_id, $passwords );

		if ( ! $saved ) {
			return new WP_Error( 'db_error', __( 'Could not save application password.' ) );
		}

		return true;
	}

	// Specified Application Password not found!
	return new WP_Error( 'application_password_not_found', __( 'Could not find an application password with that id.' ) );
}