Skip to:
Content
Pages
Categories
Search
Top
Bottom

remove profile tab – correct code?


  • 5high
    Participant

    @5high

    Hi again,

    I’d like to remove the Groups tab in a users profile, as I’ve now got new users automatically added upon registration (see here https://buddypress.org/support/topic/how-to-add-new-members-to-groups-automatically/ for how: and a HUGE thanks to @modemlooper and @mrjarbenne for this).

    I’ve found previous threads and which have given this:

    // removing groups tab from profile
    define( ‘BP_DEFAULT_COMPONENT’, ‘profile’ );
    
    function bp_remove_nav_tabs() {
    global $bp;
    bp_core_remove_nav_item( ‘groups’ );
    }
    add_action( ‘bp_setup_nav’, ‘bp_remove_nav_tabs’, 15 );

    which I’ve added into my bp-custom.php

    This works great! BUT I’m sure I’ve seen somewhere (can’t track it down now) that you can also declare it as ‘false’ to remove it, so something like this:
    $bp->bp_nav['groups']['position'] = false;

    Is this because of the recent BP updates? or is it just a different way? Or have I totally imagined it?!

    Any insight would be great! Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)

  • danbp
    Participant

    @danbp

    Guess this was used around BP 1.6 and previous. A related tread about this could be this one.

    For more information, see bp-core-buddybar.php:40

    Perhaps you also read a ticket. This one ?


    5high
    Participant

    @5high

    Thanks for the links @danbp.

    From the 2nd link, I think it’s suggesting that I can add the ‘false’ statement in instead???

    So what’s the best policy for now – leave the code as I’ve got it now (as posted above)? or try to reformulate it with the add_filter ‘false’ statement, referencing the code they mention: (‘bp_get_group_create_nav_item’, ‘__return_false’ );

    And if the latter, how exactly should it be written?
    Cheers.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘remove profile tab – correct code?’ is closed to new replies.
Skip to toolbar