This page gives you information on filtering the bp_has_members loop:
https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-members-loop/
We’ve implemented filtering on profile field values – but did it in 2 passes. It’s fairly complex once you start tying in with the AJAX handling of the members directory.
thank you Roger for the information page. I already see it : what about “search_terms optional” can you give me an exemple ?
best regard,
Moque
I’ll be surprised if anyone has a sample piece of code using search_terms to post on the forum
You may be best to give it a try — write some test code, and see what happens.
By walking through the bp_has_members() function, you should be able to determine how to set up your search string
ok i’ll try ! and i show here my test (i’m not a developper it’s why i ask an exemple…)
hi Roger ! i test :
and it’s work !
But in fact i want to be able to sort the members by the field “country”. I suppose i have to work with the function bp_ajax_querystring…any advice or encouragement …
Moque
roger,
i’m not english speaking. can you explain your sentence :
“We’ve implemented filtering on profile field values – but did it in 2 passes. It’s fairly complex once you start tying in with the AJAX handling of the members directory.”
merci
Moque
I was just saying: integration avec le AJAX (de BP) est tres dificil..
… mais oui… bp_ajax_querystring is the important thing.
I don’t have an example, and I don’t know of any documentation on this. Maybe someone else can show you a code sample.
Bon chance
Roger
Thank you Roger, you are so cute when you answer in french !
I’ll continue to looking for a solution and give it if i find something…
this morning i find that link : https://buddypress.org/community/groups/creating-extending/forum/topic/show-list-of-members-filtered-by-profile-field/…
Have a nice day,
Moque
@moque – je te le dis franchement, je ne parle pas francais