WordPress.org

Ready to get started?Download WordPress

Forums

BP Group Hierarchy
Different tabs on parent groups? (6 posts)

  1. 4dmedia
    Member
    Posted 1 year ago #

    Hi, I am using Groups Hierarchy for a directory style website. I am using parent groups to display regions, and subgroups for specific experiences/activites :

    click here

    For parent groups such as, "this I would like the navigation bar to be hidden and the subgroups that appear http://www.experiencebc.ca/groups/vancouver-coast-mountains/hierarchy/ to be the only thing that is seen.

    I only want the tabs such as Home, Members etc. to appear on a subgroup - not a parent group. Any help would be greatly appreciated.

    Thanks,
    Barry

    http://wordpress.org/extend/plugins/bp-group-hierarchy/

  2. David Dean
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Barry,

    Check out BuddyPress's function bp_get_options_nav() for insight on how the tabs are built. There's a filter in that function you can hook to hide certain tabs.

    For the other part, BP Group Hierarchy includes some functions you can use to tell where a group is in the hierarchy. In this case, you may just want to use bp_group_hierarchy_has_parent() which will return false for top-level groups.

    Hope that helps!

    - David

  3. 4dmedia
    Member
    Posted 1 year ago #

    Thanks David,

    Do you know if the filter for bp_get_options_nav works with tabs created by 3rd party plugins?

  4. David Dean
    Member
    Plugin Author

    Posted 1 year ago #

    From what I can tell, it will call filters for all tabs that are displayed even if they're 3rd party.

  5. dpeek
    Member
    Posted 1 year ago #

    I have a similar goal, and here is the function that works (as of BP 1.6) to remove a tab (in this case the activity tab):
    $bp->bp_options_nav[$bp->groups->current_group->slug]['activity'] = false;

    What I can't seem to manage is how the conditional calling code should look or even where it should be in this case. The simplest approach would be to obviously throw it in bp-custom.php like usual, which I've tried, using the following code:

    if ( bp_group_hierarchy_has_parent()) {

    $bp->bp_options_nav[$bp->groups->current_group->slug]['members'] = false;

    }

    But naturally it fails to undefined function error. I've tried to include the hierarchy class file, and setup a new handler for the class, but that fails to a 'cannot redeclare class'.

    What's the easiest way to access that function from bp-custom.php?

  6. 4dmedia
    Member
    Posted 1 year ago #

    Hey David, thank you for your responses. Dpeek, what action are you using to hook into?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.