You are here

public function Group::userRoles in Group 7

Retrieve a user's roles for a group.

Parameters

int $uid: The uid of the user to retrieve the roles for.

Return value

array An array of GroupRole objects, keyed by their machine name.

1 call to Group::userRoles()
Group::userHasRole in classes/group.inc
Check if a given user has a certain role for a group.

File

classes/group.inc, line 371
Defines the Entity API class for groups.

Class

Group
Main class for groups.

Code

public function userRoles($uid) {
  if ($group_membership = $this
    ->getMember($uid)) {
    return $group_membership
      ->getRoles();
  }
  return array();
}