New
PeoplePress is here. Community building for WordPress, reimagined. Fast, modern, and built for the communities you've always wanted to run.
See it live

BuddyDev

Search

Filter for specific members type in the members loop

  • Participant
    Level: Enlightened
    Posts: 23
    y2gabs on #25392

    Hey there, I’m creating a second members-loop page template that I’d like to filter for a specific members type(s). I can’t use your members type filter shortcode because I can only display specific profile fields in this members loop (which differ from my main members loop page) for privacy reasons. How can I use your plugin to filter for a specific members type inside the members loop?

    Thanks!

  • Keymaster
    (BuddyDev Team)
    Posts: 25513
    Brajesh Singh on #25393

    Hi,
    Thank you for the question.

    Since you can not use the shortcode and you are creating a different page/loop, your best option is to use
    member_type__not_in or member_type__in option in the bp_has_members()
    You can specify one or more member type to exclude or include.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 23
    y2gabs on #25404

    Thanks very much for your reply! I’m having a tough time finding the best syntax implementation of what you describe above. Can you elaborate with an example. Thanks again!

  • Keymaster
    (BuddyDev Team)
    Posts: 25513
    Brajesh Singh on #25412

    Hi,
    Are you able to use bp_has_members in your loop? Can you please post the line you are using for it and I can share the updated version of that with you.

    Thank you
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 23
    y2gabs on #25439

    Hi Brajesh! Thanks so much for your reply here! I actually don’t know where to start with an example using the bp_has_members hook in a loop. Are you able to provide me with a snippet that I can start with that includes filtering for a member type?

    Thanks again!

  • Keymaster
    (BuddyDev Team)
    Posts: 25513
    Brajesh Singh on #25440

    Hi,
    I am sorry if I was notr very clear.

    Since you mentioned you are creating a custom loop, Can you please tell me how are you creating a custom loop?

    If you create a members loop, It will need the above function. If I can get some idea on how are you creating the members loop, I can assist better.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 23
    y2gabs on #25474

    Oh no, my bad. I am not creating a custom loop, I’m creating a custom page template with a members loop inside of it. Basically each page template will be a loop filtered for a specific member type. Does that make sense?

  • Keymaster
    (BuddyDev Team)
    Posts: 25513
    Brajesh Singh on #25487

    Hi,
    I am sorry but what is the custom loop. Unless you modify something how will you be able to create a custom loop.

    If you want to filter for member type and do not want to use our shortcode, you will need to write a loop.

    I need to know the code for that loop.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved