Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/07/2014 11:31:26 PM (5 years ago)
Author:
imath
Message:

Improve the way Group's Manage tabs are generated

In BP_Group_Extension->setup_edit_hooks() method, we are now using the bp_core_new_subnav_item() function to generate the Group's manage tab sub navigation.
The action 'groups_admin_tabs' is no more used. However for back compatibility reasons, we will keep on catching this hook inviting the user using a _doing_it_wrong message to now use the BuddyPress Group Extension API instead.

props boonebgorges

Fixes #5994

File:
1 edited

Legend:

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

    r9091 r9127  
    2727 *       viewed user.
    2828 */
    29 function bp_get_options_nav() {
     29function bp_get_options_nav( $parent_slug = '' ) {
    3030    $bp = buddypress();
    3131
     
    3333    // component as an index. Otherwise we need to use the component's root_slug
    3434    $component_index = !empty( $bp->displayed_user ) ? bp_current_component() : bp_get_root_slug( bp_current_component() );
     35    $selected_item   = bp_current_action();
    3536
    3637    if ( ! bp_is_single_item() ) {
     
    4142        }
    4243    } else {
    43         if ( !isset( $bp->bp_options_nav[bp_current_item()] ) || count( $bp->bp_options_nav[bp_current_item()] ) < 1 ) {
     44        $current_item = bp_current_item();
     45
     46        if ( ! empty( $parent_slug ) ) {
     47            $current_item  = $parent_slug;
     48            $selected_item = bp_action_variable( 0 );
     49        }
     50
     51        if ( !isset( $bp->bp_options_nav[$current_item] ) || count( $bp->bp_options_nav[$current_item] ) < 1 ) {
    4452            return false;
    4553        } else {
    46             $the_index = bp_current_item();
     54            $the_index = $current_item;
    4755        }
    4856    }
     
    5563
    5664        // If the current action or an action variable matches the nav item id, then add a highlight CSS class.
    57         if ( $subnav_item['slug'] == bp_current_action() ) {
     65        if ( $subnav_item['slug'] == $selected_item ) {
    5866            $selected = ' class="current selected"';
    5967        } else {
     
    6573
    6674        // echo out the final list item
    67         echo apply_filters( 'bp_get_options_nav_' . $subnav_item['css_id'], '<li id="' . $subnav_item['css_id'] . '-' . $list_type . '-li" ' . $selected . '><a id="' . $subnav_item['css_id'] . '" href="' . $subnav_item['link'] . '">' . $subnav_item['name'] . '</a></li>', $subnav_item );
     75        echo apply_filters( 'bp_get_options_nav_' . $subnav_item['css_id'], '<li id="' . $subnav_item['css_id'] . '-' . $list_type . '-li" ' . $selected . '><a id="' . $subnav_item['css_id'] . '" href="' . $subnav_item['link'] . '">' . $subnav_item['name'] . '</a></li>', $subnav_item, $selected_item );
    6876    }
    6977}
     
    19181926        $retval = bp_is_groups_component() && groups_get_current_group();
    19191927    }
    1920    
     1928
    19211929    return (bool) $retval;
    19221930}
Note: See TracChangeset for help on using the changeset viewer.