Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Make members list default to alphabetical

  • Avatar of Bruce
    Bruce
    Participant

    @bnowthen

    I want to make the members list page default to an alphabetical sort.
    I’ve searched through BuddyPress forums and tried a couple things suggested in the past, but they didn’t work.
    I’m using BuddyPress Version 2.0.2 in WordPress 2014 theme.
    I don’t know much php, so if you have the answer, I need to be told where exactly to insert or edit any code.

    Would greatly appreciate any help.

    Bruce

Viewing 3 replies - 1 through 3 (of 3 total)
  • Avatar of danbp
    danbp
    Moderator

    @danbp

    Hi @bnowthen,

    this is one of the most common thing you can do with BuddyPress. ;-) .
    To do that, you have to read the Codex, about members loop.

    First, you will create a child-theme of 2014.
    Than you add a folder called buddypress to it.
    In this folder, you add a sub folder called members.
    You than make a copy of members-loop.php.
    This file is in wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress/members/

    Now, you open the copied file and replace the content of line 16.

    Replace this:
    <?php if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : ?>
    with this:
    <?php if ( bp_has_members( bp_ajax_querystring( 'members' ) . '&type=alphabetical' ) ) : ?>

    Save and enjoy.

    References

    http://codex.wordpress.org/Child_Themes

    http://codex.buddypress.org/developer/loops-reference/the-members-loop/

    Avatar of Bruce
    Bruce
    Participant

    @bnowthen

    Thanks, but I have one correction for those not familiar with php. Delete the comment “//” marks just before the “if” statement, or you come up with no list at all.

    So <?php //if ( bp_has_members( bp_ajax_querystring( ‘members’ ) . ‘&type=alphabetical’ ) ) : ?>

    Should be:

    <?php if ( bp_has_members( bp_ajax_querystring( ‘members’ ) . ‘&type=alphabetical’ ) ) : ?>

    Thanks again. This was very helpful, especially the instruction to put the buddypress code in the child theme folder.

    Avatar of danbp
    danbp
    Moderator

    @danbp

    You’re welcome, and thank you for the advice. I corrected the snippet accordingly.

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

The topic ‘[Resolved] Make members list default to alphabetical’ is closed to new replies.