hide pro-sites admin buttons for top pro-site level


Is it possible to hide the pro-sites upgrade button for the highest pro-sites level users.

For instance. The top level users shouldn't see it, because they have nowhere to upgrade to, there are already at the top level.

Thanks in advance

  • Alexander
    • DEV MAN’s Mascot

    Hi @tinygiantstudios,

    Sure, I can help you with this. So do you mean the dashboard menu item? Or just that link in the admin bar?

    If you can just let me know the exact instances, I'll see about putting something together to do this for you! I can get started in the meantime, but would just like to be sure. Thanks!

    Best regards, Alexander Rohmann

  • Alexander
    • DEV MAN’s Mascot

    Alright, I've taken a look to see if there was a quick code fix, but there isn't a simple way to do this without modifying the plugin.

    If you're interested in coding it yourself I can point you in the right direction, but I won't be able to create the code for you here.

    Just let me know, and I can save you some time by proving a few code references. Sorry we couldn't accomodate this directly.

    Best regards, Alexander Rohmann

  • Alexander
    • DEV MAN’s Mascot

    Ok, so the admin bar link is created on line 598 of pro-sites.php

    You can just wrap it in an "if" statement to prevent it from being added, so something like this:

    if($this->get_level($blog_id) == "your highest level")
        $wp_admin_bar->add_menu ........

    Look into how the get_level function works. You'll need to write your condition to match its output. And be careful because as it returns 0 if the blog isn't a pro site, so make sure that the admin bar isn't removed for them.

    As for the admin menu link, you can do something similar right around line 566

    Let me know how it goes!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.