$userhasRole()

Does this user have the given Role?

Example

if($user->hasRole('editor')) {
  // user has the editor role
}

Usage

$bool = $user->hasRole($role);

Arguments

NameType(s)Description
$rolestring Role int

May be Role name, object or ID.

Return value

bool


$user methods and properties

API reference based on ProcessWire core version 3.0.251