You can use this filter hook:
apply_filters( 'bp_nouveau_get_groups_directory_nav_items', $nav_items );
Found in: buddypress\bp-templates\bp-nouveau\includes\groups\functions.php
You can definitely add a nav item with that hook.
And you should be able to reorder the existing items.
Take a look at the nav item structure:
function pp_groups_dir_nav ( $nav ) {
echo '<pre>'; var_dump( $nav ); echo '</pre>';
return $nav;
}
add_filter( 'bp_nouveau_get_groups_directory_nav_items', 'pp_groups_dir_nav' );
But you are writing a custom theme, so it would be easier to write a custom function to replace
function bp_nouveau_get_groups_directory_nav_items
rather than filter the current output.
@shanebp, thanks for responding. Apologies if my language was confusing. You are right that I mean the Groups component directory and not the member profile page.
My users are primarily interested in navigating to their existing groups. Only occasionally will they want to explore other groups. I’d like to eliminate the extra step and distraction of the current tab order.
Anyone else have any ideas about how to change the tab order on the Groups Directory page in Nouveau?
I just discovered that if I select the My Groups tab, go away from the /groups/ page and then return to it, it retains the My Groups tab as the active tab. I wonder if there is a way to force this?
Looks like we were writing in parallel! I’ll see what I can do with your edited response.
@shanebp, hooking into ‘bp_nouveau_get_groups_directory_nav_items’ works well to modify the nav items (thanks for that).
For testing purposes, I’ve created an ‘Others’ tab which is intended to display the groups that the member does not belong to. It links out to an ‘others.php’ template file but I haven’t been able to get this new nav item to do anything. Rather, it just duplicates the behavior of the ‘All Groups’ tab. I suspect I’m missing something that hooks into the AJAX process. Might @imath be some help with this as the creator of bp-nouveau?
imath might respond, but it is unlikely. They are rarely on these forums.
You’ll need to walk thru the code to see every step of how other tabs are handled.
I would look at the My Groups code.
It may well be an ajax issue.
If you find a solution, please update this topic.
btw – when you dump the $nav items to the screen, did you notice that the Create array includes a no-ajax
entry?
Perhaps get that working and then try an ajax solution.
Thanks again for your response. I did notice the no-ajax
entry. I’ll dig into the My Groups code and see what I can find. If I find a solution, I update this topic.
I’ve got this sorted out. I filter bp_nouveau_get_groups_directory_nav_items
to unset $nav[‘all’], adjust the properties of $nav[‘personal’] so it’s selected and first, get the group counts for My Groups and Other Groups, and specify the properties of $nav[‘others’]
I also filter bp_nouveau_ajax_querystring
to query for the ‘others’ list.
I’ve created a gist with the code.
Thanks for the follow-up and the gist!
Remember – you can always add a page to the codex too.
Hey @rgilman,
Very interested by the gist! Unfortunately it’s not available anymore 🙁
Thanks!
@rgilman gist is not available anymore and I tried myself to fix it with very little php knowledge and got nowhere. Do you might like to share it here? Thanks
Or maybe somebody else can help.
How can I modify ‘bp_nouveau_get_groups_directory_nav_items’ with apply_filter to make “my-groups” default in directory listing?