You are here

function social_group_get_all_group_members in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_group/social_group.module \social_group_get_all_group_members()
  2. 8.2 modules/social_features/social_group/social_group.module \social_group_get_all_group_members()
  3. 8.3 modules/social_features/social_group/social_group.module \social_group_get_all_group_members()
  4. 8.4 modules/social_features/social_group/social_group.module \social_group_get_all_group_members()
  5. 8.5 modules/social_features/social_group/social_group.module \social_group_get_all_group_members()
  6. 8.6 modules/social_features/social_group/social_group.module \social_group_get_all_group_members()
  7. 8.7 modules/social_features/social_group/social_group.module \social_group_get_all_group_members()
  8. 8.8 modules/social_features/social_group/social_group.module \social_group_get_all_group_members()
  9. 10.3.x modules/social_features/social_group/social_group.module \social_group_get_all_group_members()
  10. 10.0.x modules/social_features/social_group/social_group.module \social_group_get_all_group_members()
  11. 10.1.x modules/social_features/social_group/social_group.module \social_group_get_all_group_members()
  12. 10.2.x modules/social_features/social_group/social_group.module \social_group_get_all_group_members()

Get all group memberships for a certain user.

2 calls to social_group_get_all_group_members()
ActivityFilterPersonalisedHomepage::query in modules/custom/activity_viewer/src/Plugin/views/filter/ActivityFilterPersonalisedHomepage.php
Filters out activity items the user is not allowed to see.
ActivityPostVisibilityAccess::query in modules/custom/activity_viewer/src/Plugin/views/filter/ActivityPostVisibilityAccess.php
Filters out activity items the user is not allowed to see.

File

modules/social_features/social_group/social_group.module, line 1110
The Social group module.

Code

function social_group_get_all_group_members($uid) {
  $group_content_types = GroupContentType::loadByEntityTypeId('user');
  $group_content_types = array_keys($group_content_types);
  $query = \Drupal::database()
    ->select('group_content_field_data', 'gcfd');
  $query
    ->addField('gcfd', 'gid');
  $query
    ->condition('gcfd.entity_id', $uid);
  $query
    ->condition('gcfd.type', $group_content_types, 'IN');
  $query
    ->execute()
    ->fetchAll();
  $group_ids = $query
    ->execute()
    ->fetchAllAssoc('gid');
  return array_keys($group_ids);
}