Skip to:
Content
Pages
Categories
Search
Top
Bottom

Member filtering


  • Zoe Ellison
    Participant

    @zoe-ellison

    I followed this topic to list my members alphabetically by their last name: https://buddypress.org/support/topic/sort-user-list-by-last-name/

    I changed :

    
    <?php if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : ?>
    

    To this:

     <?php if ( bp_has_members( bp_ajax_querystring( 'members' ).'&type=alphabetical' ).'&exclude=1,4,3,5,512 ' ) : ?>
    

    And then Added this to my child theme functions.php

    
    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' );
    

    For some reason this brakes the Order by filter, does anyone know if there is a way of fixing this.

  • The topic ‘Member filtering’ is closed to new replies.
Skip to toolbar