WC_Shortcode_My_Account::get_password_reset_state_expiration │ private static │ WC 1.0

Get the current WordPress expiration for a user's hashed reset state.

Old-style activation keys do not carry a request timestamp. WordPress may still accept those through the password_reset_key_expired filter, so the bridge's own short expiry remains the limit for that compatibility path.

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

Хуки из метода

Возвращает

int. Unix expiry timestamp.

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

$result = WC_Shortcode_My_Account::get_password_reset_state_expiration( $user );
$user(WP_User) (обязательный)
Token owner.

Код WC_Shortcode_My_Account::get_password_reset_state_expiration() WC 11.2.2

private static function get_password_reset_state_expiration( $user ) {
	if ( false === strpos( $user->user_activation_key, ':' ) ) {
		return PHP_INT_MAX;
	}

	list( $request_time ) = explode( ':', $user->user_activation_key, 2 );
	if ( ! ctype_digit( $request_time ) ) {
		return 0;
	}

	// This filter is documented in WordPress core.
	// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
	$expiration_duration = (int) apply_filters( 'password_reset_expiration', DAY_IN_SECONDS );

	return (int) $request_time + max( 0, $expiration_duration );
}