Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/21/2011 01:03:41 PM (15 years ago)
Author:
johnjamesjacoby
Message:

Switch individual group navigation to use current_item as slug instead of root_component, to avoid collisions in bp_options_nav resulting in single groups not being visible if the group->slug is the same as the group->root_slug. Adjust the bp_core_new_nav_item() and bp_core_new_subnav_item() functions to look for new current_item option. Should be backwards compatible with existing group extensions, but will need testing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-template.php

    r4050 r4057  
    2222    $component_index = !empty( $bp->displayed_user ) ? $bp->current_component : bp_get_root_slug( $bp->current_component );
    2323
    24     if ( !isset( $bp->bp_options_nav[$component_index] ) || count( $bp->bp_options_nav[$component_index] ) < 1 )
    25         return false;
     24    if ( !bp_is_single_item() ) {
     25        if ( !isset( $bp->bp_options_nav[$component_index] ) || count( $bp->bp_options_nav[$component_index] ) < 1 ) {
     26            return false;
     27        } else {
     28            $the_index = $component_index;
     29        }
     30    } else {
     31        if ( !isset( $bp->bp_options_nav[$bp->current_item] ) || count( $bp->bp_options_nav[$bp->current_item] ) < 1 ) {
     32            return false;
     33        } else {
     34            $the_index = $bp->current_item;
     35        }
     36    }
    2637
    2738    // Loop through each navigation item
    28     foreach ( (array)$bp->bp_options_nav[$component_index] as $subnav_item ) {
     39    foreach ( (array)$bp->bp_options_nav[$the_index] as $subnav_item ) {
    2940        if ( !$subnav_item['user_has_access'] )
    3041            continue;
Note: See TracChangeset for help on using the changeset viewer.