BP_REST_Groups_Endpoint::can_see( BP_Groups_Group $group )

Can a user see a group?

Description

Parameters

$group

(Required) Group object.

Return

(bool)

Source

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

	protected function can_see( $group ) {

		// If it is not a hidden group, user can see it.
		if ( 'hidden' !== $group->status ) {
			return true;
		}

		// Check for moderators or if user is a member of the group.
		return ( bp_current_user_can( 'bp_moderate' ) || groups_is_user_member( bp_loggedin_user_id(), $group->id ) );
	}

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.