Automattic\WooCommerce\Admin\Features

TransientNotices::get_queue_by_user()public staticWC 1.0

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

{} It's a method of the class: TransientNotices{}

No Hooks.

Return

Array.

Usage

$result = TransientNotices::get_queue_by_user( $user_id );
$user_id(int) (required)
User ID.

Code of TransientNotices::get_queue_by_user() WC 6.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'];
		}
	);
}