Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

Screenshot

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.

share|improve this question

3 Answers 3

up vote 3 down vote accepted

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' );
share|improve this answer
    
this has no effect for me in BP 1.6.2 –  Zade Feb 13 '13 at 11:43

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' );
share|improve this answer
    
this causes page not found errors for me in BP 1.6.2 –  Zade Feb 13 '13 at 11:43

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 :-)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.