Automattic\WooCommerce\Admin\Features

TransientNotices::get_queue_by_user()public staticWC 1.0

Get all notices in the queue by a given user ID.

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

Хуков нет.

Возвращает

Массив.

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

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

Код TransientNotices::get_queue_by_user() WC 8.7.0

public static function get_queue_by_user( $user_id ) {
	$notices = self::get_queue();

	return array_filter(
		$notices,
		function( $notice ) use ( $user_id ) {
			return ! isset( $notice['user_id'] ) ||
				null === $notice['user_id'] ||
				$user_id === $notice['user_id'];
		}
	);
}