BP_Group_Extension::user_meets_access_condition( string $access_condition )

Check whether the current user meets an access condition.

Description

Parameters

$access_condition

(Required) 'anyone', 'loggedin', 'member', 'mod', 'admin' or 'noone'.

Return

(bool)

Source

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

	protected function user_meets_access_condition( $access_condition ) {

		switch ( $access_condition ) {
			case 'admin' :
				$meets_condition = groups_is_user_admin( bp_loggedin_user_id(), $this->group_id );
				break;

			case 'mod' :
				$meets_condition = groups_is_user_mod( bp_loggedin_user_id(), $this->group_id );
				break;

			case 'member' :
				$meets_condition = groups_is_user_member( bp_loggedin_user_id(), $this->group_id );
				break;

			case 'loggedin' :
				$meets_condition = is_user_logged_in();
				break;

			case 'noone' :
				$meets_condition = false;
				break;

			case 'anyone' :
			default :
				$meets_condition = true;
				break;
		}

		return $meets_condition;
	}

Changelog

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