Skip to:
Content
Pages
Categories
Search
Top
Bottom

Groups/Members alphabetical sort by default

  • @becskr

    Participant

    I was using the function below before on our site to sort the groups alphabetically but since the latest update, it made all the ajax pagination stop working. I looked at the release notes and there was the following “Only run BP-Default AJAX functions if a POST request.” – I can’t find any information about this change but I am running a child theme so wondered if this would have affected the below. Does anyone have an alternative solution for showing alphabetical by default?

    `function sort_alpha_by_default( $qs ) {
    global $bp;
    if (!$qs && ( $bp->current_component == BP_GROUPS_SLUG || $bp->current_component == BP_MEMBERS_SLUG ) )
    $qs = ‘type=alphabetical&action=alphabetical’;
    return $qs;
    }
    function groups_alpha_by_default( $query_string ) {
    global $bp;

    if ( $bp->current_component == BP_GROUPS_SLUG && !$bp->current_action)
    $query_string = ‘type=alphabetical&action=alphabetical’;

    return $query_string;
    }
    add_filter( ‘bp_dtheme_ajax_querystring’, ‘groups_alpha_by_default’ );

    add_filter( ‘bp_dtheme_ajax_querystring’, ‘sort_alpha_by_default’ );`

Viewing 4 replies - 1 through 4 (of 4 total)
  • @naijaping

    Participant

    @becskr, you may try the following, 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’ );
    ?>

    `

    change the per page to your own requirement.

    regards

    @becskr

    Participant

    Thank you SO MUCH. That worked a treat!

    @becskr

    Participant

    Just realised that this doesn’t work because it prevents you being able to sort with either of the other two options on the drop down. I still want to have other ways to sort….can anyone help?

    @becskr

    Participant

    Anyone???

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Groups/Members alphabetical sort by default’ is closed to new replies.
Skip to toolbar