You can use the $bp global, so for example this:
`if( $bp->current_component == BP_MEMBERS_SLUG && $bp->current_action == ‘subnav-slug’ && $bp->action_variables[0] == ‘subnav-variable’ )
{
// do something
}`
Here’s something else I was trying to create. This would be great for theme devs. Basically wanted to merge the user nav and subnav together. This code works great but I’m not sure how to only show the subnav when on the parent user nav. This code just outputs everything. I got as far as showing only the first link by wrapping echo in an if statement because when you click a parent link you are in essence on the firs subnav.
http://pastebin.com/LCW3wsZ9
Well, it should work. What’s the exact code you were using?
Also, it’s worth noting that the `$bp` global behaves a bit differently when on a member page. Take this for example:
https://buddypress.org/community/members/username/settings/
`$bp->current_component` wouldn’t be members, as you might expect, but settings. In that case you could check for `$bp->displayed_user->id`.
To test, I used it to just echo a string if on the profile of a members page.
I’m using it on a member page not members direectory. Taking the user nav and the sub nav and putting it into a sidebar so when you click profile on the user nav the get options nav shows underneath.
bp-default has 2 separate navs and calls the options nav depending on the user nav. I want to mush that into one nav.