Skip to:
Content
Pages
Categories
Search
Top
Bottom

Change default members directory sorting


  • andreadrago
    Participant

    @andreadrago

    Hello,
    In a website I’m working on, we need to change the members directory default sorting from “last active” to “newest”.
    Currently, we’ve done it by creating a custom members-loop.php page and changing this string:

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

    to

    <?php
    	$query = bp_ajax_querystring( 'members' );
    	if (strpos($query, "type=") === FALSE) {
    		$query = "type=newest&".$query;
    	}
    ?>
    <?php if ( bp_has_members( $query ) ) : ?>

    This works, but it doesn’t change the dropdown in the top-right of the page. Is there a better way that changes the default sorting option and keeps the dropdown consistent?

    Thank you in advance

Viewing 1 replies (of 1 total)

  • rafafallo
    Participant

    @rafafallo

    Your piece of code have saved my day. Thank you so much!

    I guess you have solved your problem, after four months. Basically, you have to copy the memmbers/index.php, either from bp-legacy or bp-noveau (depending which you are using), to your theme buddypress/members directory, and modify the order of the options in the select element.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar