Skip to:
Content
Pages
Categories
Search
Top
Bottom

Alphabetize groups?


  • dalemcgregor
    Participant

    @dalemcgregor

    Is there a way to set my groups so that they file in alphabetical order when I input them? As of now, they are ordered in reverse order I create them. To be clear, when my users go to the Group page from the menu, they will see the last group I created 1st, and the 1st group I created last.

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

  • Venutius
    Moderator

    @venutius

    Yes there is, it involes a minor amount of code wrangling. First of all you need to install a child-theme. You can get plugins for that if you’ve not already got one. This will create a directory on your server called wp-content/themes/your-child-theme.

    In that directory create a buddypress/groups directory.

    The next step is to work out which BP Theme you are using. You can find that by looking in Settings>>BuddyPress>>Options.

    Once you know that, you will be able to find a file called `wp-content/plugins/buddypress/bp-templates/your-bp-theme/buddypress/groups/groups-loop.php.

    Take a copy of this file and find this part:
    <?php if ( bp_has_groups( bp_ajax_querystring( 'groups' ) ) ) : ?>
    Change that to:
    <?php if ( bp_has_groups( bp_ajax_querystring( 'groups' ) . '&order=ASC&orderby=name' ) ) : ?>

    Next you put this file in the themes/child-theme/buddypress/groups directory you created earlier.


    dalemcgregor
    Participant

    @dalemcgregor

    Hopefully they create a setting soon that would alleviate the need to go thru all these steps. Your instructions seem fairly straightforward, although I’m not sure what half of it is. I’ll ask my bestie Google for help on that. Thanks for the reply!


    shanebp
    Moderator

    @shanebp

    The solution provided by @venutius will work just fine.

    Personally, I would use this filter hook from groups_get_groups in bp-groups-functions.php:
    apply_filters_ref_array( 'groups_get_groups', array( &$groups, &$r ) );
    And one of the php array sort functions to resort the groups, probably asort.

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