BUDDYBOSS WEB

Your community, courses and memberships on your own website.

BUDDYBOSS APP

Your own branded app on iOS and Android.

DONE FOR YOU

We build, launch and run it for you.

BuddyBoss website and mobile app

Web + App Done For You

$4,999 flat

Web Scale + Done For You Web

App Launch + Done For You App

PRICING

Web Pricing

Launch, Scale and Done For You Web.

From

$199

first year

App Pricing

Solo, Launch and Done For You App.

From

$499

first year

SITE + APP

Web + App Done For You

Your site and your app, built and run for you.

$4,999

flat, never rises

How to Display Group Members Alphabetically

Updated

Introduction

BuddyBoss does not currently provide a built-in option to display group members in alphabetical order. However, you can achieve this behavior by adding a small custom function to your active theme. This customization will sort group members alphabetically based on their display names, improving readability and usability within groups. This guide explains how you can display group members alphabetically.

Custom Workaround

Before proceeding, make sure you have a complete site backup.

  1. Go to Appearance > Theme File Editor in your WordPress admin dashboard.
  2. Under Select theme to edit, choose your active theme (preferably a BuddyBoss Child Theme), then click Select.
  3. From the Theme Files list, open Theme Functions (functions.php).
  4. Add the following code just before the closing PHP tag (?>):
/**
 * Filter the group member IDs and return them sorted alphabetically by display name.
 *
 * @param array $value The array of user IDs to be filtered.
 * @return array $sorted_users The array of sorted user IDs by display name.
 */
add_filter( 'bp_group_member_query_group_member_ids', 'bb_bp_group_has_members' );

function bb_bp_group_has_members( $value ) {

    // Arguments for fetching users by specified IDs and ordering by display name
    $args = [
        'include' => $value,          // Include only the specified user IDs
        'orderby' => 'display_name',  // Order by display name
        'order'   => 'ASC',           // Ascending order
    ];

    // Fetch users based on the provided arguments
    $users = get_users( $args );

    // Initialize an empty array to hold sorted user IDs
    $sorted_users = [];

    // Loop through the users and collect their IDs
    foreach ( $users as $user ) {
        $sorted_users[] = $user->ID;
    }

    // Return the sorted user IDs
    return $sorted_users;
}
  1. Click Update File to save the changes.

Note: Modifications are typically considered custom work, but we are making an exception in this case. Please review the BuddyBoss Support Policy.

Troubleshooting and FAQs

Q: Group members are still not sorted alphabetically.
A: Make sure the code is added to your child theme’s functions.php file and not the parent theme. Clear any caching plugins and refresh the group page.

Q: Will this affect member listings outside of groups?
A: No. This only affects the display order of members within BuddyBoss groups.

Q: Does this sort by username or full name?
A: This sorts members by their display name, as set in their WordPress profile.

Q: Can I revert this change easily?
A: Yes. Simply remove or comment out the code from functions.php and save the file.

Was this article helpful?

Subscribe to Our Newsletter

This field is for validation purposes and should be left unchanged.
This field is hidden when viewing the form

Can’t find the answer you’re looking for?

Our support team is here to help with anything the docs don’t cover.