public function Group::userHasRole in Group 7
Check if a given user has a certain role for a group.
Parameters
int $uid: The uid of the user to check for.
string $role: The machine name of the group role.
Return value
bool Whether the user has the specified role.
File
- classes/
group.inc, line 390 - Defines the Entity API class for groups.
Class
- Group
- Main class for groups.
Code
public function userHasRole($uid, $role) {
return array_key_exists($role, $this
->userRoles($uid));
}