Merged in feature/280-dev-dev01 (pull request #21)
auto-patch 280-dev-dev01-2024-01-19T16_41_58 * auto-patch 280-dev-dev01-2024-01-19T16_41_58
This commit is contained in:
@@ -280,6 +280,19 @@ class WC_Admin_Notices {
|
||||
do_action( 'woocommerce_hide_' . $name . '_notice' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given user has dismissed a given admin notice.
|
||||
*
|
||||
* @since 8.5.0
|
||||
*
|
||||
* @param string $name The name of the admin notice to check.
|
||||
* @param int|null $user_id User id, or null for the current user.
|
||||
* @return bool True if the user has dismissed the notice.
|
||||
*/
|
||||
public static function user_has_dismissed_notice( string $name, ?int $user_id = null ): bool {
|
||||
return (bool) get_user_meta( $user_id ?? get_current_user_id(), "dismissed_{$name}_notice", true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add notices + styles if needed.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user