Skip to:
Content

BuddyPress.org

Changeset 11090


Ignore:
Timestamp:
09/13/2016 05:35:46 AM (8 years ago)
Author:
boonebgorges
Message:

Accept a group ID instead of an array in groups_get_group().

The fact that groups_get_group() required an array was an annoying
side-effect of the fact that BP_Groups_Group had a 'populate_extras'
argument. Now that the latter is gone, the function signature can be
simplified.

See #5451.

File:
1 edited

Legend:

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

    r11086 r11090  
    3737 *
    3838 * @since 1.2.0
    39  *
    40  * @param array|string $args {
    41  *     Array of al arguments.
    42  *     @type int  $group_id        ID of the group.
    43  *     @type bool $load_users      No longer used.
    44  *     @type bool $populate_extras Whether to fetch membership data and other
    45  *                                 extra information about the group.
    46  *                                 Default: false.
    47  * }
     39 * @since 2.7.0 The function signature was changed to accept a group ID only,
     40 *              instead of an array containing the group ID.
     41 *
     42 * @param int $group_id ID of the group.
    4843 * @return BP_Groups_Group $group The group object.
    4944 */
    5045function groups_get_group( $args = '' ) {
    51     $r = wp_parse_args( $args, array(
    52         'group_id'          => false,
    53         'load_users'        => false,
    54         'populate_extras'   => false,
    55     ) );
    56 
    57     $group_args = array(
    58         'populate_extras' => $r['populate_extras'],
    59     );
    60 
    61     $group = new BP_Groups_Group( $r['group_id'], $group_args );
     46    // Backward compatibilty.
     47    if ( is_array( $args ) && isset( $args['group_id'] ) ) {
     48        $group_id = $args['group_id'];
     49    }
     50
     51    $group = new BP_Groups_Group( $group_id );
    6252
    6353    /**
Note: See TracChangeset for help on using the changeset viewer.