How to sort alphabetically the members directory


This article is outdated. Woffice has a new documentation here: 


If anything is missing, let us know and we will improve it. It was designed to be searchable, more organized and more complete. 


By default, members directory is sorted by recent activity. In this way only members that have logged at least one time are displayed.

You can solve this sorting members alphabetically.

For version 2.3.0 or earlier:

There is now an option in Theme Settings > Buddypress that allows to sort the members in a different way:

For version 2.0.4 or earlier:

Just copy the code below in the file functions.php of your child theme:

add_filter('woffice_members_loop_query', 'woffice_members_loop_query');
function woffice_members_loop_query($query) {
   return $query . '&type=alphabetical';

For versions older then 2.0.4:

It's really easy, just one line to change : 

You have to copy \woffice\buddypress\members\members-loop.php in your child theme, search for (beginning of the file) :

<?php if ( bp_has_members(bp_ajax_querystring( 'members' ).'&exclude='.$exclude_members) ) : ?>

and replace with :

<?php if ( bp_has_members(bp_ajax_querystring( 'members' ).'&exclude='.$exclude_members.'&type=alphabetical') ) : ?>

That's all. Once saved that'll work ;)

Note that you need to copy the whole path as well  to your child theme :