ure_admin_menu_access_not_block_url

Custom filter `ure_admin_menu_access_not_block_url` is used by “Admin menu access” add-on and allows to whitelist not selected URL (without path, like admin.php?page=mlw_quiz_options), which is not presented at the admin menu and it’s not possible to select such URL with the “Block not Selected” model. Pay attention that it’s not full URL, without domain, path and includes only permanent part without arguments which can be changed according to the context.

Example of this filter usage for restricted user with ‘test_role_2’:

add_filter('ure_admin_menu_access_not_block_url', 'ure_not_block_url', 10, 2 );

function ure_not_block_url( $not_block, $url ) {
    
    $user = wp_get_current_user();
    if ( !is_array( $user->roles ) ) { 
        return $not_block;
    }
    
    if ( !in_array( 'test_role_2', $user->roles ) ) {   // replace 'test_role_2' with your own role ID
        return $not_block;
    }
    
    $allowed_urls = array(
        'admin.php?page=mlw_quiz_options',
        'admin.php?page=qsm_quiz_result_details'
        );
    
    foreach( $allowed_urls as $allowed_url ) {
        if ( strpos( $url, $allowed_url )!==false ) {
            $not_block = true;
            break;
        }
    }
    
    return $not_block;
}