BP_Group_Extension::user_meets_access_condition( string $access_condition )

Check whether the current user meets an access condition.


Parameters Parameters

$access_condition

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


Top ↑

Return Return

(bool)


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


Top ↑

Changelog Changelog

Changelog
Version Description
2.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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