Display members with certain roles first (Buddypress)

Hello,

How could I display members with specific roles first in Groups & Members directories of Buddypress?

  • James Morris
    • WordPress Enthusiast

    Hello lesanis,

    Thank you for your question.

    Doing a bit of digging around, it looks as though you'll need to create a custom page template. I've found the following thread quite useful. -> Show members with certain role

    There's code in that thread that will help you build a custom page template that displays users that fit in a specific role. This is a good starting point for achieving what you're after.

    Please let me know if you have any further questions. I'll be happy to help! :slight_smile:

    Best regards,

    James Morris

  • lesanis
    • Design Lord, Child of Thor

    Hello James,

    The code in that thread helps to built a custom page template with only specific users but I need to display all the users and just change the order of appearing. I would like specific roles to appear first in the list. Is that possible?

    Thank you,
    lesanis

  • James Morris
    • WordPress Enthusiast

    Hello lesanis,

    Looking over the documentation for BuddyPress Groups Loop, I found where you can pass arguments in the loop to change the order of the groups display, but it's limited.

    type optional
    Defines the type of groups to return.

    Accepted arguments: active, newest, popular, random, alphabetical, most-forum-topics, most-forum-posts
    Default value: active

    Unless you're wanting to go in alphabetical order, I believe what you are going to need is some custom code. You could post your requirements in the Jobs & Pros board and one of the community members could help you come up with a custom solution.

    Please let me know if you have any further questions. I'll be happy to help! :slight_smile:

    Best regards,

    James Morris

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.