groups_get_group( int $group_id )
Fetch a single group object.
Description Description
When calling up a group object, you should always use this function instead of instantiating BP_Groups_Group directly, so that you will inherit cache support and pass through the groups_get_group filter.
Parameters Parameters
- $group_id
-
(Required) ID of the group.
Return Return
(BP_Groups_Group) $group The group object.
Source Source
File: bp-groups/bp-groups-functions.php
function groups_get_group( $group_id ) { /* * Backward compatibilty. * Old-style arguments take the form of an array or a query string. */ if ( ! is_numeric( $group_id ) ) { $r = bp_parse_args( $group_id, array( 'group_id' => false, 'load_users' => false, 'populate_extras' => false, ), 'groups_get_group' ); $group_id = $r['group_id']; } $group = new BP_Groups_Group( $group_id ); /** * Filters a single group object. * * @since 1.2.0 * * @param BP_Groups_Group $group Single group object. */ return apply_filters( 'groups_get_group', $group ); }
Changelog Changelog
Version | Description |
---|---|
2.7.0 | The function signature was changed to accept a group ID only, instead of an array containing the group ID. |
1.2.0 | Introduced. |