BP_REST_Groups_Endpoint::get_group_object( WP_REST_Request $request )

Get group object.

Description

Parameters

$request

(Required) Full details about the request.

Return

(bool|BP_Groups_Group)

Source

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

	public function get_group_object( $request ) {
		if ( ! empty( $request['group_id'] ) ) {
			$group_id = (int) $request['group_id'];
		} elseif ( is_numeric( $request ) ) {
			$group_id = $request;
		} else {
			$group_id = (int) $request['id'];
		}

		$group = groups_get_group( $group_id );

		if ( empty( $group ) || empty( $group->id ) ) {
			return false;
		}

		return $group;
	}

Changelog

Changelog
Version Description
0.1.0 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.