WC_Product_Usage_Notice::is_any_notices_dismissed_recently()private staticWC 1.0

Check whether the user dismissed any product usage notices recently.

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

Хуков нет.

Возвращает

true|false.

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

$result = WC_Product_Usage_Notice::is_any_notices_dismissed_recently( $user_id ): bool;
$user_id(int) (обязательный)
User ID.

Код WC_Product_Usage_Notice::is_any_notices_dismissed_recently() WC 9.4.2

private static function is_any_notices_dismissed_recently( int $user_id ): bool {
	$global_last_dismissed_ts = absint(
		get_user_meta(
			$user_id,
			self::LAST_DISMISSED_TIMESTAMP_META,
			true
		)
	);
	if ( 0 === $global_last_dismissed_ts ) {
		return false;
	}

	$seconds_since_dismissed = time() - $global_last_dismissed_ts;

	$wait_after_any_dismisses = self::$product_usage_notice_rules['wait_in_seconds_after_any_dismisses'];

	return $seconds_since_dismissed < $wait_after_any_dismisses;
}