Filter uncanny-continuing-education-credits

uncanny_owl_admin_notifications_has_access

Filters whether an administrator has access to notification settings, allowing customization of access control.

add_filter( 'uncanny_owl_admin_notifications_has_access', $callback, 10, 1 );

Description

Fires when checking if the current user has access to Uncanny Owl admin notifications. Developers can filter the `$access` boolean to grant or deny access programmatically, overriding the default `manage_options` capability check. Defaults to true if user can manage options.


Usage

add_filter( 'uncanny_owl_admin_notifications_has_access', 'your_function_name', 10, 1 );

Parameters

$access (mixed)
This parameter determines whether the current user has access to admin notifications.

Return Value

The filtered value.


Examples

// Allow users with the 'edit_posts' capability to also see admin notifications,
// in addition to those with 'manage_options'.
add_filter( 'uncanny_owl_admin_notifications_has_access', function( $access ) {

    // Check if the current user has the 'edit_posts' capability.
    if ( current_user_can( 'edit_posts' ) ) {
        // If they do, grant access to the notifications.
        $access = true;
    }

    // Return the modified access status.
    return $access;

}, 10, 1 );

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

src/notifications/notifications.php:305

public function has_access() {

			$access = false;

			if ( current_user_can( 'manage_options' ) ) {

				$access = true;

			}

			return apply_filters( 'uncanny_owl_admin_notifications_has_access', $access );
		}

Scroll to Top