When removing "My Sites" in ultimate Branding, Network Admin Does note show up

When I select to hide the My Sites menu in ultimate branding; I have no option to access the Network admin. Not Kewl!!! :p

Will ya fix this for me?

Peace, Love, Joy, and My Sites for Network Admins... :slight_smile:

  • Michael Bissett
    • Recruit

    Challenge accepted @Mark Wall. And hey, hope you're having a good day today! :slight_smile:

    To start with, are you wanting to hide the "My Sites" menu for only sub-site admins?

    If so, here's what you can do! :slight_smile:

    Using the following code:

    function role_admin_body_class( $classes ) {
        global $wpdb, $current_user;
    
        get_currentuserinfo();
    
        if (is_super_admin()) {
              $classes .= 'mtbsite-superadmin';
        } else {
             $classes .= 'mtbsite-user';
        }
    
        return trim( $classes );
    }
    
    add_filter( 'admin_body_class', 'role_admin_body_class', 50 );

    You can set a body class for both the super admin (you), as well as a class for everyone else. You can take that code, and turn it into a mu-plugin:

    http://www.newnine.com/learn/how-to-create-a-wordpress-mu-plugin

    Then, for hiding the the "My Sites" button, here's the CSS code you'd need to enter into the Custom Admin CSS module inside of Ultimate Branding:

    .mtbsite-user #wp-admin-bar-my-sites {
        display: none;
    }

    Hope that helps!

    Regards,
    Michael

  • ivan
    • New Recruit

    I inserted this code in ultimate-branding.php and it worked!! However, it only hides the "My Sites" button in the dashboard and as soon as members goes to membersite.websiteexample.com "My Sites" button reappears. Any thoughts about this guys?

    Thanks for your help

  • Ash
    • WordPress Hacker

    Hello @ivan

    I hope you are well today.

    Insert the code as mu-plugins.

    To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Hope it helps :slight_smile: Please feel free to ask more question if you have.

    Cheers
    Ash

  • ivan
    • New Recruit

    It doesn't work, maybe I'm doing something wrong? Would you please Ashok be more specific...regarding "I inserted this code in ultimate-branding.php and it worked!! However, it only hides the "My Sites" button in the dashboard and as soon as members goes to memberblog.websitexample.com "My Sites" button reappears" .
    Thank you

  • Ash
    • WordPress Hacker

    Hey there.

    Thanks for posting in this thread, however it might be best if you open your own, even if the issues seem closely related. That way it will remain independent of this one and ensure it doesn't confuse issues here if this thread needs reopening again by the author.

    It also means the member who started this thread or anyone following it isn't inundated with post notifications each time we respond to each other. A lengthy thread could annoy the original poster.

    This also allows us to better track and answer your questions to ensure we don't miss any for you.

    You can start a new thread here: (tag me in the new thread and give a reference of this thread, include your issue again, I will pop up in there and solve the issue for you)

    https://premium.wpmudev.org/forums/#question

    Thanks
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.