BP_REST_Forums_Endpoint::bp_rest_get_group( int $forum_id )

Get Forum’s group.

Description

Parameters

$forum_id

(Required) ID of the forum.

Return

(BP_Groups_Group|string)

Source

File: bp-forums/classes/class-bp-rest-forums-endpoint.php

	public function bp_rest_get_group( $forum_id ) {
		if ( empty( $forum_id ) ) {
			return '';
		}

		if ( bbp_get_forum_group_ids( $forum_id ) ) {
			$group              = groups_get_group( current( bbp_get_forum_group_ids( $forum_id ) ) );
			$group->avatar_urls = array();
			if ( ! bp_disable_group_avatar_uploads() ) {
				$group->avatar_urls = array(
					'thumb' => bp_core_fetch_avatar(
						array(
							'html'    => false,
							'object'  => 'group',
							'item_id' => $group->id,
							'type'    => 'thumb',
						)
					),
					'full'  => bp_core_fetch_avatar(
						array(
							'html'    => false,
							'object'  => 'group',
							'item_id' => $group->id,
							'type'    => 'full',
						)
					),
				);
			}

			return $group;
		}

		return '';

	}

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.