OK.. I found the following to address the Sub Nav items… I took your code and added the subnav items.. resulting in the following longer code. You replaced bp_get_displayed_user_nav() with my_bp_get_displayed_user_nav()
I also replaced bp_get_options_nav() with my_bp_get_options_nav()
And I then had to copy over all the php files in buddypress/members/single over to my child theme.
And I replaced all instances of bp_get_options_nav() with my_bp_get_options_nav()
It required me to change around 12 pages.. which is a pain!
Here is the code I also added to my functions.php after your code:
function my_bp_get_options_nav() {
global $bp;
// If we are looking at a member profile, then the we can use the current component as an
// index. Otherwise we need to use the component's root_slug
$component_index = !empty( $bp->displayed_user ) ? bp_current_component() : bp_get_root_slug( bp_current_component() );
if ( !bp_is_single_item() ) {
if ( !isset( $bp->bp_options_nav[$component_index] ) || count( $bp->bp_options_nav[$component_index] ) < 1 ) {
return false;
} else {
$the_index = $component_index;
}
} else {
if ( !isset( $bp->bp_options_nav[bp_current_item()] ) || count( $bp->bp_options_nav[bp_current_item()] ) < 1 ) {
return false;
} else {
$the_index = bp_current_item();
}
}
// Loop through each navigation item
foreach ( (array) $bp->bp_options_nav[$the_index] as $subnav_item ) {
if ( !$subnav_item['user_has_access'] )
continue;
// If the current action or an action variable matches the nav item id, then add a highlight CSS class.
if ( $subnav_item['slug'] == bp_current_action() ) {
$selected = ' class="current selected"';
} else {
$selected = '';
}
// List type depends on our current component
$list_type = bp_is_group() ? 'groups' : 'personal';
// echo out the final list item
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'] . '#item-body" rel="nofollow">' . $subnav_item['name'] . '</a></li>', $subnav_item );
}
}
I’m sure there is an easier way to change this stuff.. as it doesn’t work on the Group navigation items within the Group pages.. buy hey.. at lease I won’t have people yelling at me that the site doesn’t work when they are on a laptop!
Thanks again sharmstr!