Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/21/2011 01:03:41 PM (14 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-buddybar.php

    r4027 r4057  
    5454
    5555    /***
    56      * If we are not viewing a user, and this is a root component, don't attach the
    57      * default subnav function so we can display a directory or something else.
     56     * If the nav item is visible, we are not viewing a user, and this is a root
     57     * component, don't attach the default subnav function so we can display a
     58     * directory or something else.
    5859     */
    59     if ( bp_is_root_component( $slug ) && !bp_displayed_user_id() )
     60    if ( ( -1 != $position ) && bp_is_root_component( $slug ) && !bp_displayed_user_id() )
    6061        return;
    6162
     63    // Look for current component
    6264    if ( bp_is_current_component( $slug ) && !bp_current_action() ) {
     65        if ( !is_object( $screen_function[0] ) )
     66            add_action( 'bp_screens', $screen_function );
     67        else
     68            add_action( 'bp_screens', array( &$screen_function[0], $screen_function[1] ), 3 );
     69
     70        if ( !empty( $default_subnav_slug ) )
     71            $bp->current_action = $default_subnav_slug;
     72
     73    // Look for current item
     74    } elseif ( bp_is_current_item( $slug ) && !bp_current_action() ) {
    6375        if ( !is_object( $screen_function[0] ) )
    6476            add_action( 'bp_screens', $screen_function );
     
    186198    );
    187199
     200    // Look for current component
    188201    if ( ( $bp->current_action == $slug && $bp->current_component == $parent_slug ) && $user_has_access ) {
     202        if ( !is_object( $screen_function[0] ) )
     203            add_action( 'bp_screens', $screen_function );
     204        else
     205            add_action( 'bp_screens', array( &$screen_function[0], $screen_function[1] ) );
     206
     207    // Look for current item
     208    } elseif ( ( $bp->current_action == $slug && $bp->current_item == $parent_slug ) && $user_has_access ) {
    189209        if ( !is_object( $screen_function[0] ) )
    190210            add_action( 'bp_screens', $screen_function );
Note: See TracChangeset for help on using the changeset viewer.