@jcrowell
8 years, 1 month ago
So I can’t get the sorting by LAST NAME to work. By default buddypress uses the display name on the members directory so I’m using this function to get it to display the xprofile data.
function my_directory() { if ( bp_is_active( 'xprofile' ) ) if ( $membername = xprofile_get_field_data( 'First Name', bp_get_member_user_id() ) . ' ' . xprofile_get_field_data( 'Last Name', bp_get_member_user_id() ) . ' ' . xprofile_get_field_data( 'Title', bp_get_member_user_id() ) ) : echo '<div class="dir_name">'; echo $membername; echo '</div>'; endif; } add_filter ( 'bp_member_name', 'my_directory' );
But the function you provided above doesn’t sort by the xprofile data. Any help?
8 years, 2 months ago
@manakio2k, Thanks! it worked like a charm for me.
For anyone still having issues, after <?php do_action( ‘bp_before_members_loop’ ) ?> Insert
<?php do_action( ‘bp_before_members_loop’ ) ?>
<?php if ( bp_ajax_querystring( 'members' ) =="") { $queryString = "type=alphabetical&action=alphabetical&page=1"; } else { $queryString = bp_ajax_querystring( 'members' ); } ?>
Then replace <?php if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : ?> with <?php if ( bp_has_members( $queryString) ) : ?>
<?php if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : ?>
<?php if ( bp_has_members( $queryString) ) : ?>
That’s it. If you want to limit the Ordering options, go into index.php and comment out the options in the dropdown.