BP_Groups_Group::get_user_has_access()

Checks whether the logged-in user has access to the group.


Description Description


Return Return

(bool)


Top ↑

Source Source

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

	protected function get_user_has_access() {
		if ( isset( $this->user_has_access ) ) {
			return $this->user_has_access;
		}

		if ( ( 'private' === $this->status ) || ( 'hidden' === $this->status ) ) {

			// Assume user does not have access to hidden/private groups.
			$this->user_has_access = false;

			// Group members or community moderators have access.
			if ( ( is_user_logged_in() && $this->get_is_member() ) || bp_current_user_can( 'bp_moderate' ) ) {
				$this->user_has_access = true;
			}
		} else {
			$this->user_has_access = true;
		}

		return $this->user_has_access;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.7.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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