WC_Helper::update_auth_option()public staticWC 1.0

Updates auth options and flushes cache

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$result = WC_Helper::update_auth_option( $access_token, $access_token_secret, $site_id ): void;
$access_token(строка) (обязательный)
The access token.
$access_token_secret(строка) (обязательный)
The secret access token.
$site_id(int) (обязательный)
The site id returned by the API.

Код WC_Helper::update_auth_option() WC 8.7.0

public static function update_auth_option( string $access_token, string $access_token_secret, int $site_id ): void {
	WC_Helper_Options::update(
		'auth',
		array(
			'access_token'        => $access_token,
			'access_token_secret' => $access_token_secret,
			'site_id'             => $site_id,
			'user_id'             => get_current_user_id(),
			'updated'             => time(),
		)
	);

	// Obtain the connected user info.
	if ( ! self::_flush_authentication_cache() ) {
		self::log( 'Could not obtain connected user info in _helper_auth_return.' );
		WC_Helper_Options::update( 'auth', array() );
		wp_die( 'Something went wrong. Could not obtain connected user info in _helper_auth_return.' );
	}

	self::_flush_subscriptions_cache();
	self::_flush_updates_cache();
}