I looked at the BuddyPress core files global.js and ajax.php in /bp_default/_inc/ and found the function that manages the filter select box.
Then I fixed the HTML and used the appropriate classes and now the select box works and the groups loop is re-queried (using BuddyPress AJAX) but it reloads the default loop template instead of my modified loop template.
I also added the search bar to my page using bp_directory_groups_search_form() and that works perfectly. The search results are returned using the modified groups loop.
Any ideas how I could make the filter select box reload by modified groups loop too?
Ay, thanks for that link. It certainly asnwers some of my questions!
Earlier I tried taking the selected value and storing it using jQuery.post but I couldn’t figure out how to get a working URL and even if I did, how would the groups list get refreshed?
I figured that BuddyPress has something that already does this. I looked into bp-themes/bp-default/_inc/ajax.php and saw how the bp_ajax_querystring filter is updated there with information from the browser cookies. And I assume that the directory template is reloaded using this function in the same file : bp_dtheme_object_template_loader()
It’s possible that the value from the select form is already stored but the reason why the template isn’t updating is because this line in ajax.php :