You are here

public function MembershipManagerInterface::getUserGroupsByRoleIds in Organic groups 8

Returns an array of groups filtered by the OG roles of the user.

Parameters

int $user_id: The ID of the user to get the groups for.

string[] $role_ids: A list of OG role IDs to filter by.

string[] $states: (optional) An array of states to filter the memberships by.

bool $require_all_roles: (optional) If set to TRUE, all requested roles must be present to return the group. Set to FALSE to return the groups that match one or more of the requested roles. Defaults to TRUE.

Return value

\Drupal\Core\Entity\ContentEntityInterface[][] An associative array, keyed by group entity type, each item an array of group entities.

1 method overrides MembershipManagerInterface::getUserGroupsByRoleIds()
MembershipManager::getUserGroupsByRoleIds in src/MembershipManager.php
Returns an array of groups filtered by the OG roles of the user.

File

src/MembershipManagerInterface.php, line 78

Class

MembershipManagerInterface
Membership manager interface.

Namespace

Drupal\og

Code

public function getUserGroupsByRoleIds($user_id, array $role_ids, array $states = [
  OgMembershipInterface::STATE_ACTIVE,
], bool $require_all_roles = TRUE) : array;