Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: [Resolved] Alphabetical pagination

@shanebp

Moderator

Add this to your theme/functions.php or plugins/bp-custom.php

// members loop - sort by last word in Name if type==alphabetical
function alphabetize_by_last_name( $bp_user_query ) {
    if ( 'alphabetical' == $bp_user_query->query_vars['type'] )
        $bp_user_query->uid_clauses['orderby'] = "ORDER BY substring_index(u.display_name, ' ', -1)";
}
add_action ( 'bp_pre_user_query', 'alphabetize_by_last_name' );
Skip to toolbar