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 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’ ).


Top ↑

Parameters Parameters

$group

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

Default value: null


Top ↑

Return Return

(bool)


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


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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