WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Super Admin User Level (2 posts)

  1. Tom
    Member
    Posted 3 years ago #

    I'm creating a quick plugin for myself that hides the "My Sites" panel when anyone but a super admin of a network is logged in. I'm essentially trying to keep the admins of their respective sites in their own environment and keep them away from the main admin, regardless if they have privileges or not.

    My code is here:

    http://pastebin.com/ziRccfzS

    Only issue is, level_10 includes administrators. I've done some research, but it doesn't seem that super admins have a specific user level. Is this true or do they and I just couldn't find it?

    And if they don't, can I block all user's except my account (the only super admin on the network)?

  2. Tom
    Member
    Posted 3 years ago #

    Well I created a workaround.

    I figured, for now, my Superadmin Account will be the only one that is accessing the sites, and all other users can have that page hidden. So I did the following:

    function remove_the_dashboard () {
    global $current_user;
          get_currentuserinfo(); //Get Current Userinfo
          $user = $current_user->ID; //Find Users ID
    		if ($user == '1') { //if the users ID is Tom's id (1) give him everything
    			return;
    		} else { //everyone else, remove the "My Sites" panel
    			global $menu, $submenu, $user_ID;
    		unset($submenu['index.php'][5]); // Removes 'My Sites'.
    		}
    
    }
    add_action('admin_menu', 'remove_the_dashboard');

    A few Steps:

    1. Check Userinfo
    2. Get the Current User ID
    3. Match it to my ID (1, in this case). If it is 1, then give me the Admin menu.
    4. If it is not 1, remove the "my Sites" panel.

    A simple workaround, just won't work if you have multiple superadmins. In that case, you would add their ID's as well.

    Resolved!

Topic Closed

This topic has been closed to new replies.

About this Topic