BP_REST_Groups_Endpoint::can_see( BP_Groups_Group $group )

Can a user see a group?


Parameters Parameters

$group

(BP_Groups_Group) (Required) Group object.


Top ↑

Return Return

(bool)


Source 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 ) );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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