Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)

  • Jon Crowell
    Participant

    @jcrowell

    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?


    Jon Crowell
    Participant

    @jcrowell

    @manakio2k, Thanks! it worked like a charm for me.

    For anyone still having issues, after
    <?php do_action( ‘bp_before_members_loop’ ) ?>
    Insert

    <?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) ) : ?>

    That’s it. If you want to limit the Ordering options, go into index.php and comment out the options in the dropdown.

Viewing 2 replies - 1 through 2 (of 2 total)
Skip to toolbar