You are here

public function MembershipManagerInterface::getUserGroupIdsByRoleIds in Organic groups 8

Returns an array of groups ids 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

array[] An associative array, keyed by group entity type, each item an array of group IDs.

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

File

src/MembershipManagerInterface.php, line 98

Class

MembershipManagerInterface
Membership manager interface.

Namespace

Drupal\og

Code

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