Support » Plugin: Members - Membership & User Role Editor Plugin » Hide Members Pages for certain user roles

  • Resolved InfoBahn

    (@infobahntechnologies)


    // Remove Access to Certain Pages
    add_action( 'load-options-general.php', 'ipad_prevent_access' );
    add_action( 'load-options-writing.php', 'ipad_prevent_access' );
    add_action( 'load-options-reading.php', 'ipad_prevent_access' );
    add_action( 'load-options-discussion.php', 'ipad_prevent_access' );
    add_action( 'load-options-media.php', 'ipad_prevent_access' );
    add_action( 'load-options-permalink.php', 'ipad_prevent_access' );
    add_action( 'load-options.php', 'ipad_prevent_access' );
    //add_action( 'members', 'prevent_seoguy_access' ); //Not working
    //add_action( 'members-settings', 'prevent_seoguy_access' ); //Not working
    
    function ipad_prevent_access(){
    
    	$user = wp_get_current_user();
        if( !in_array( 'super_admin', (array) $user->roles ) ){
        
            wp_die("You don't have access to this page");
            exit();
        }
    }

    super_admin has user postion:120.
    Trying to hide it from the administrator. Administrator has manage_options access.
    Create, Delete, Edit, List user roles permissions for the admin have been revoked.

    • This topic was modified 3 years, 1 month ago by InfoBahn. Reason: More information
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Hide Members Pages for certain user roles’ is closed to new replies.