bp_group_is_visible( BP_Groups_Group|null $group = null )

Is the group accessible to the currently logged-in user? Despite the name of the function, it has historically checked whether a user has access to a group.

Description

In BP 2.9, a property was added to the BP_Groups_Group class, is_visible, that describes whether a user can know the group exists. If you wish to check that property, use the check: bp_current_user_can( ‘groups_see_group’ ).

Parameters

$group

(Optional) Group object. Default: current group in loop.

Default value: null

Return

(bool)

Source

File: bp-groups/bp-groups-template.php

function bp_group_is_visible( $group = null ) {
	global $groups_template;

	if ( bp_current_user_can( 'bp_moderate' ) ) {
		return true;
	}

	if ( empty( $group ) ) {
		$group =& $groups_template->group;
	}

	return bp_current_user_can( 'groups_access_group', array( 'group_id' => $group->id ) );
}

Changelog

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