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.

Top ↑

Parameters Parameters


(int) (Required) ID of the group.

Top ↑

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 );

Top ↑

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.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.