BP_Groups_Group::is_visible()

Checks whether the current user can know the group exists.

Description

Return

(bool)

Source

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

660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
protected function is_visible() {
    if ( isset( $this->is_visible ) ) {
        return $this->is_visible;
    }
 
    if ( 'hidden' === $this->status ) {
 
        // Assume user can not know about hidden groups.
        $this->is_visible = false;
 
        // Group members or community moderators have access.
        if ( ( is_user_logged_in() && $this->get_is_member() ) || bp_current_user_can( 'bp_moderate' ) ) {
            $this->is_visible = true;
        }
    } else {
        $this->is_visible = true;
    }
 
    return $this->is_visible;
}

Changelog

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