bp_groups_get_activity_group( integer $group_id )

Get the group object the activity belongs to.

Description

Parameters

$group_id

(Required) The group ID the activity is linked to.

Return

(BP_Groups_Group) The group object the activity belongs to.

Source

File: bp-groups/bp-groups-activity.php

function bp_groups_get_activity_group( $group_id = 0 ) {
	// If displaying a specific group, check the activity belongs to it.
	if ( bp_is_group() && bp_get_current_group_id() === (int) $group_id ) {
		$group = groups_get_current_group();

		// Otherwise get the group the activity belongs to.
	} else {
		$group = groups_get_group( $group_id );
	}

	return $group;
}

Changelog

Changelog
Version Description
BuddyPress 5.0.0 BuddyPress 5.0.0
BuddyBoss 1.3.5 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.