Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/19/2013 12:09:30 AM (11 years ago)
Author:
boonebgorges
Message:

Introduces 'order' and 'orderby' parameters for the bp_has_groups() stack

'order' and 'orderby' are more specific and flexible versions of the existing
'type' parameter ('popular', 'newest', etc). Backward compatibility is
maintained by always obeying 'type' when it is passed, and by internally
converting the legacy 'type' values into the corresponding 'order' and
'orderby' values.

Adds unit tests to ensure that the adjusted default values for functions in
the stack are backward compatibile (in particular, the fact that the 'type'
parameter is now empty by default, replaced with the corresponding default
values for 'order' and 'orderby'). Unit tests are also added for the new
params, as well as some internal utility methods.

See #4483

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups/bp-groups-functions.php

    r6950 r7087  
    414414
    415415    $defaults = array(
    416         'type'            => 'active', // active, newest, alphabetical, random, popular, most-forum-topics or most-forum-posts
     416        'type'            => false,    // active, newest, alphabetical, random, popular, most-forum-topics or most-forum-posts
     417        'order'           => 'DESC',   // 'ASC' or 'DESC'
     418        'orderby'         => 'date_created', // date_created, last_activity, total_member_count, name, random
    417419        'user_id'         => false,    // Pass a user_id to limit to only groups that this user is a member of
    418420        'include'         => false,    // Only include these specific groups (group_ids)
     
    438440        'per_page'        => $r['per_page'],
    439441        'page'            => $r['page'],
    440         'populate_extras' => $r['populate_extras']
     442        'populate_extras' => $r['populate_extras'],
     443        'order'           => $r['order'],
     444        'orderby'         => $r['orderby'],
    441445    ) );
    442446
Note: See TracChangeset for help on using the changeset viewer.