Tribe__Admin__Notices::has_user_dismissed( string $slug, int|null $user_id = null )
Checks if a given user has dismissed a given notice.
Contents
Parameters
- $slug
-
(string) (Required) The name of the notice.
- $user_id
-
(int|null) (Optional) The user ID.
Default value: null
Return
(boolean)
Source
File: src/Tribe/Admin/Notices.php
public function has_user_dismissed( $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;
}
$notice = $this->get( $slug );
if (
is_object( $notice )
&& $notice->recurring
&& $this->should_recurring_notice_show( $slug, $user_id )
) {
return false;
}
return true;
}
Changelog
| Version | Description |
|---|---|
| 4.13.0 | Introduced. |