Skip to:

How to get all Group nav items?

  • Sven Lehnert


    I need to know the group nav items.

    with “$bp->bp_options_nav[groups]” I will get the nav items, from my groups:

    foreach ( $bp->bp_options_nav[groups] as $nav_item ) {
    echo $nav_item['name'].", ";

    Will give me back:

    * My Groups

    * Create a Group

    * Invites

    But I need the nav items from the displayed group. Not my groups.

    For it would be:

    * Home

    * Wire

    * Members

    * Send Invites

    * Leave Group

    For the user profile I found it:

    foreach ( $bp->bp_nav as $user_nav_item ) {
    if ( !$user_nav_item['show_for_displayed_user'] )
    echo $user_nav_item['name'].", ";

    With the “show_for_displayed_user” I will get a filtered list with all nav items from a displayed user. Not the logged in user.

    Is there a way to get the group nav items?

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

  • Boone Gorges


    It looks like $bp->bp_options_nav[groups] is populated differently when you’re inside of the group loop than when you’re not. That’s probably at least in part because the optionsbar items are different for different groups (some don’t have the forum activated, for example) and even for different users (admins vs mods vs regular members). In any case, if you put your code inside of a group loop

    if ( bp_has_groups() ) : while ( bp_groups() ) : bp_the_group();

    you might get what you’re looking for for each individual group.

    Sven Lehnert


    Hi Boone Gorges, thanks a lot for your replay.

    This is exactly the situation.

    If you are in the group loop, it gives you back the group nav items depends on the settings and user rights.

    But this does not help me.

    For the SEO plugin I’m writing I need to know where the components could be.

    It doesn’t matter, if there is a forum in a specific group or not.

    There can be a forum so I have to SEO it.

    For example:

    If you have the group_document plugin installed, this plugin ads a menu item to groups, “Documents”.

    So I have to SEO Group/Documents/.

    If the group admin turns of group_documents, its just for this specific group. But in other groups there will be group_documents, and need SEO.

    So for my case I am just interested in the components and where they are used.

    I have nearly the logic. Just the groups are missing.

    Lets have a look at the group_document component as example:

    It’s not in $bp->root_components, so its not a root component

    links, members, register, activate, search, blog, blogs, forums, groups, events, activity,

    It’s in $bp->active_components, so it must be somewhere…

    settings, activity, blogs, friends, groups, messages, wire, profile, status, events, group_documents, links, forums,

    It’s not in $bp->bp_options_nav, so its not a profile component.

    settings, friends, links, activity, blogs, groups, messages, wire, profile, events,

    Also I can check if this component for example has a wire:

    echo "<br>has a wire?<br>";
    foreach ( (array)$bp->active_components as $key => $value ) {
    if ($bp->$value->table_name_wire){
    print_r( $value );
    echo ', ';

    In this case (groups, profile, events, links) have a wire.

    But how can I find out if this component will below to groups?

    My idea was to look at the unfiltered group nav items….

    Sorry for my terrible English.

    It’s always my problem. I hope you understand what I tried to say, and one of you have an idea.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to get all Group nav items?’ is closed to new replies.
Skip to toolbar