Tribe__Admin__Notices::get_last_dismissal( string $slug, int|null $user_id = null )
Gets the last Dismissal for a given notice slug and user.
Contents
Parameters
- $slug
-
(string) (Required) Slug of the notice to look for.
- $user_id
-
(int|null) (Optional) Which user? If null will default to current user.
Default value: null
Return
(false|TribeUtilsDate_I18n)
Source
File: src/Tribe/Admin/Notices.php
public function get_last_dismissal( $slug, $user_id = null ) {
if ( is_null( $user_id ) ) {
$user_id = get_current_user_id();
}
$dismissed_time = get_user_meta( $user_id, static::$meta_key_time_prefix . $slug, true );
if ( ! is_numeric( $dismissed_time ) ) {
return false;
}
return Dates::build_date_object( $dismissed_time );
}
Changelog
| Version | Description |
|---|---|
| 4.13.0 | Introduced. |