Skip to:
Content
Pages
Categories
Search
Top
Bottom

order members list alphabetically by default code not working

  • Avatar of funmi omoba
    funmi omoba
    Participant

    @funmi-omoba

    Hi, just wondering if there is a way to change the default Order by : filter in members directory from the Last Active To Alphabetical . i tried to re arrange it in index.php but has no effect.

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Avatar of Paul Gibbs
    Paul Gibbs
    Keymaster

    @djpaul

    It will take affect (assume you are editing correct file), but when a user picks an item, BP stores a cookie which remembers the item selected. On subsequent page loads, javascript reads this cookie and picks the item again for you.

    Avatar of funmi omoba
    funmi omoba
    Participant

    @funmi-omoba

    @djpaul, i re arranged it in members/index.php, but it just change the order of the filter tab, by default it still show last active member first on the list

    Avatar of Prince Abiola Ogundipe
    Prince Abiola Ogundipe
    Participant

    @naijaping

    If i could remember right, you can use the following code but i am not sure if it is outdated because i have it during BP 1.2.

    function sort_alpha_by_default( $qs ) {
    global $bp;
    if (!$qs && ( $bp->current_component == BP_MEMBERS_SLUG || $bp->current_component == BP_GROUPS_SLUG) )
    $qs = ’type=alphabetical&action=alphabetical’;
    return $qs;
    }
    add_filter( ’bp_dtheme_ajax_querystring’, ’sort_alpha_by_default’ );

    Avatar of funmi omoba
    funmi omoba
    Participant

    @funmi-omoba

    @naijaping, the code is not working, it close down my site.@djpaul, or any advance member, can you please help me check whats wrong with the code.

    Thanks in advance

    Avatar of Prince Abiola Ogundipe
    Prince Abiola Ogundipe
    Participant

    @naijaping

    @funmi omoba:

    At the top of members-loop.php replace the following code:

    `

    with: <?php /* My Custom Member Query to order alphabetical by default */
    function my_query_filter_new ( $query_string ) {
    $query_string .= ‘&per_page=15&type=alphabetical’;
    return $query_string;
    }
    add_filter( ‘bp_ajax_querystring’, ‘my_query_filter_new’ );
    ?>

    `

    Note : you can change per page to any number you want

    work like a charm

    regards

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

You must be logged in to reply to this topic.