BP_Groups_Group::get_group_extras( array $paged_groups, string|array $group_ids, string|bool $type = false )

Fetch extra data for a list of groups.


Description Description

This method is used throughout the class, by methods that take a $populate_extras parameter.

Data fetched:

  • Logged-in user’s status within each group (is_member, is_confirmed, is_pending, is_banned)

Top ↑

Parameters Parameters

$paged_groups

(array) (Required) Array of groups.

$group_ids

(string|array) (Required) Array or comma-separated list of IDs matching $paged_groups.

$type

(string|bool) (Optional) Not used.

Default value: false


Top ↑

Return Return

(array) $paged_groups


Source Source

File: bp-groups/classes/class-bp-groups-group.php

	public static function get_group_extras( &$paged_groups, &$group_ids, $type = false ) {
		$user_id = bp_loggedin_user_id();

		foreach ( $paged_groups as &$group ) {
			$group->is_member  = groups_is_user_member( $user_id, $group->id )  ? 1 : 0;
			$group->is_invited = groups_is_user_invited( $user_id, $group->id ) ? 1 : 0;
			$group->is_pending = groups_is_user_pending( $user_id, $group->id ) ? 1 : 0;
			$group->is_banned  = (bool) groups_is_user_banned( $user_id, $group->id );
		}

		return $paged_groups;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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