BP_Groups_Group::get_user_has_access()
Checks whether the logged-in user has access to the group.
Description
Return
(bool)
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; }
Changelog
Version | Description |
---|---|
BuddyPress 2.7.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.