Skip to:
Content
Pages
Categories
Search
Top
Bottom

directory sort by custom field : “country” in the members-loop file

  • @moque

    Participant

    hello,
    i work on a bilingual website with buddypress and i’m looking for a simple solution to sort my directory by custom field : “country” in the members-loop file or in the index file.
    Can i sort the bp_the_member() ?
    Can i add a select item “country” to the index file
    div class=”item-list-tabs” id=”subnav” role=”navigation”>

    • <!– –>

    I use the default theme of bp.
    Thank you for your help and advice.
    Moque

Viewing 9 replies - 1 through 9 (of 9 total)
  • @rogercoathup

    Participant

    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.

    @moque

    Participant

    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

    @rogercoathup

    Participant

    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

    @moque

    Participant

    ok i’ll try ! and i show here my test (i’m not a developper it’s why i ask an exemple…)

    @moque

    Participant

    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

    @moque

    Participant

    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

    @rogercoathup

    Participant

    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

    @moque

    Participant

    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/&#8230;
    Have a nice day,
    Moque

    @rogercoathup

    Participant

    @moque – je te le dis franchement, je ne parle pas francais :)

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘directory sort by custom field : “country” in the members-loop file’ is closed to new replies.
Skip to toolbar