Remove tabs from buddypress groups and members pages

Basically if you see the picture below there are 5 tab items in my groups page:

Screenshot

Read More

Now, I want to be able to remove some of them. I want to be able to remove “Members” and “Send Invites” (for instance).

This is on the frontend groups page. When you select a group and go to view it.

I don’t want to edit core files really, is there any other way to do this? Maybe a remove_action?

Thank you.

Related posts

Leave a Reply

3 comments

  1. Managed to crawl through the core code and find this function:

    bp_core_remove_subnav_item

    So you can do something like this:

    function remove_group_options() {
        global $bp;
    
        bp_core_remove_subnav_item($bp->groups->slug, 'members');
        bp_core_remove_subnav_item($bp->groups->slug, 'send-invites');
    
    }
    add_action( 'bp_setup_nav', 'remove_group_options' );
    
  2. The answer above does not work in 1.5

    $bp->groups->slug
    

    needs to become

    bp_get_current_group_slug()
    

    To support both version of bp use:

    function remove_group_options()
    {
        global $bp;
        $parent_slug = isset( $bp->bp_options_nav[$bp->groups->current_group->slug] ) ? $bp->groups->current_group->slug : $bp->groups->slug;
        bp_core_remove_nav_item( $parent_slug, 'members' );
        bp_core_remove_nav_item( $parent_slug, 'send-invites' );
    }
    add_action( 'bp_setup_nav', 'remove_group_options' );
    
  3. This is working for me in BP 2.0.1:

    The functions for removing the nav and subnav items are similar except that the subnav function requires an additional argument to specify the main nav, of which it is a sub-item.

    Thus, the following code removes the main nav item “forums” and also removes the “change-avatar” subnav item from the main nav item “Profile”:

    function remove_nav_items() {
        bp_core_remove_nav_item( 'forums' );
        bp_core_remove_subnav_item( 'profile', 'change-avatar' );
    }
    add_action( 'bp_setup_nav', 'remove_nav_items');
    

    I’ve tested this in the bp-default theme in BP 2.0.1 and also in my own site.

    Hope it helps 🙂