Tribe__Admin__Notices::has_user_dimissed( string $slug, int|null $user_id = null )

Checks if a given user has dimissed a given notice.


Parameters #

$slug

(string) (Required) The Name of the Notice

$user_id

(int|null) (Optional) The user ID

Default value: null


Top ↑

Return #

(boolean)


Top ↑

Source #

File: src/Tribe/Admin/Notices.php

	public function has_user_dimissed( $slug, $user_id = null ) {

		if ( is_null( $user_id ) ) {
			$user_id = get_current_user_id();
		}

		$dismissed_notices = get_user_meta( $user_id, self::$meta_key );

		if ( ! is_array( $dismissed_notices ) ) {
			return false;
		}

		if ( ! in_array( $slug, $dismissed_notices ) ) {
			return false;
		}

		return true;
	}

Top ↑

Changelog #

Changelog
Version Description
4.3 Introduced.