Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/21/2014 01:50:30 PM (11 years ago)
Author:
boonebgorges
Message:

Introduce support for a 'type' sorting parameter in BP_Group_Member_Query

The 'type' parameter supports any of the arguments ('newest', 'active', etc)
supported by the parent class BP_User_Query. In addition, it's possible to
sort by type 'last_joined' and 'first_joined'.

This changeset also introduces the 'type' parameter through the
bp_group_has_members() function stack.

See #921

Props imath, boonebgorges

File:
1 edited

Legend:

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

    r7932 r7948  
    385385 *           Default: 1.
    386386 *     @type array $group_role Optional. Array of group roles to include.
     387 *     @type string $search_terms Optional. Filter results by a search string.
     388 *     @type string $type Optional. Sort the order of results. 'last_joined',
     389 *           'first_joined', or any of the $type params available in
     390 *           {@link BP_User_Query}. Default: 'last_joined'.
    387391 * }
    388  * @param int $group_id
    389  * @param int $limit Maximum members to return
    390  * @param int $page The page of results to return (requires $limit)
    391  * @param bool $exclude_admins_mods Whether to exclude admins and mods
    392  * @param bool $exclude_banned Whether to exclude banned users
    393  * @param array|string $exclude Array or comma-sep list of users to exclude
    394  * @return array Multi-d array of 'members' list and 'count'
     392 * @return array Multi-d array of 'members' list and 'count'.
    395393 */
    396394function groups_get_group_members( $args = array() ) {
     
    423421        'group_role'          => array(),
    424422        'search_terms'        => false,
     423        'type'                => 'last_joined',
    425424    ) );
    426425
     
    456455            'exclude'        => $r['exclude'],
    457456            'search_terms'   => $r['search_terms'],
    458             'type'           => 'last_modified',
     457            'type'           => $r['type'],
    459458        ) );
    460459
Note: See TracChangeset for help on using the changeset viewer.