Skip to:
Content
Pages
Categories
Search
Top
Bottom

Remove “Visit” from the admin bar

  • @we-are-chesapeake

    Participant

    Hi all. I’m trying to remove the “Visit” drop down menu in the admin bar, but removing the action in bp-custom.php doesn’t seem to be doing the trick. I’ve tried:

    remove_action( ‘bp_adminbar_menus’, ‘bp_adminbar_random_menu’, 100 );

    And a number of other things to no avail. Can anyone help?

Viewing 15 replies - 1 through 15 (of 15 total)
  • @nuprn1

    Participant

    well bp-custom.php is loaded before the adminbar – so place the remove_action in your theme’s function.php file

    @moosh101

    Member

    Hi,

    You can remove the Visit random user/group by removing the links in the bp-core-adminbar.php file, found in /wp-content/plugins/buddypress/bp-core/ Its best to remove the lines of code:

    
    <li class="align-right" id="bp-adminbar-visitrandom-menu">
    <a href="#"></a>
    <ul class="random-list">
    <li><a href=&quot;root_domain . '/' . BP_MEMBERS_SLUG . '/?random-member' ?>"></a></li>
    
    <li class="alt"><a href=&quot;root_domain . '/' . $bp->groups->slug . '/?random-group' ?>"></a></li>
    
    <li><a href=&quot;root_domain . '/' . $bp->blogs->slug . '/?random-blog' ?>"></a></li>
    
    </ul>
    </li>
    

    This code appears between lines 221-237. Leave the opening function in place, just remove the code between, and including, the <li> and </li>. Save the file, reload the page and the visit links should now be gone.

    All the best,

    Shane.

    @nuprn1

    Participant

    use the remove_action – it works – modifying the core files will only be wiped out upon your next update (unless you tediously merge each file)

    @we-are-chesapeake

    Participant

    Thank you both. I’ll try removing the action in functions.php and get back.

    How does one go about finding out the order in which files are loaded?

    @nuprn1

    Participant

    just by looking at the source code (in this case open up bp-core.php and you’ll see where bp-custom.php is referenced prior to the adminbar code) + another great plugin if you have a development setup -> https://wordpress.org/extend/plugins/wordpress-hook-sniffer/

    @we-are-chesapeake

    Participant

    Just got around to doing it. Worked like a charm! Thanks so much

    @rishirich27

    Participant

    This worked for me but on ….

    line 443 and 451 in bp-core-adminbar.php file.

    @beckb

    Participant

    I was going to do the remove thing, too–so thank you all for the tips–but then I decided I might as well just hide the admin bar from logged out users, as that was my bigger concern with the random visit.anyway. (I don’t think it’ll be especially useful, and our groups are mainly private, but I don’t have any other plans for the top right portion of the screen, so…might as well leave it for now.)

    @adamzfun

    Participant

    There is a much simpler, elegant solution to this problem that does not involve messing with the core code.

    Use a custom CSS plug-in so you can add your own CSS edits (you should have this anyways) and paste the following line:
    #bp-adminbar-visitrandom-menu {display:none;}

    I like this solution much better, maybe because I am not technical enough to do the function remove method.

    Adam
    stargazerinteractive.com

    @mvvspr

    Participant

    @pcwriter ‘s Add All Nav Links to BP Adminbar plugin has an option to do this with just click of a button.
    There are many more configuration options to customise your admin bar.
    https://buddypress.org/community/groups/add-all-nav-links-to-bp-adminbar/

    @pcwriter

    Participant

    There’s also a newer, beta version of my plugin available for download with many more configuration options right in the admin panel. See this post for more:
    https://buddypress.org/community/groups/add-all-nav-links-to-bp-adminbar/forum/topic/testers-needed-for-version-2-1beta/#post-69288

    @invisibleland

    Participant

    I got this to work PERFECTLY by pasting it in my theme’s “functions.php” file:

    `remove_action( “bp_adminbar_menus”, “bp_adminbar_random_menu”, 100 );`

    (NOTE: this was mentioned earlier but had single-quotes rather than double-quotes, which didn’t work for me)

    PS. The Add All Nav Links to BP Adminbar plugin (or I-have-an-unnecessarily-long-ass-name plugin) removed other links from my page, so that didn’t help.

    @pcwriter

    Participant

    @invisibleland

    Did you check the feature options for the plugin under ‘Settings’ > ‘BP-WP-Navbar’?
    It can be set to remove only the random menu, without modifying anything else.

    BTW, I agree that the plugin does have a long-ass-name but, as long as it does what it says it does, does it really matter?

    @vusisindane

    Participant

    Wow this is really strange:

    this works
    `remove_action( “bp_adminbar_menus”, “bp_adminbar_random_menu”, 100 );`

    this does not work
    `remove_action( ‘bp_adminbar_menus’, ‘bp_adminbar_random_menu’, 100 );`

    can somebody explain why?

    @djpaul

    Keymaster

    The quoting shouldn’t matter. Please don’t bring up 1.4 year old threads with a new question; make your own topic.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Remove “Visit” from the admin bar’ is closed to new replies.
Skip to toolbar