You are here

function social_group_group_content_insert in Open Social 10.1.x

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

When creating a new group membership.

Parameters

\Drupal\group\Entity\GroupContentInterface $group_content: The group content.

File

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

Code

function social_group_group_content_insert(GroupContentInterface $group_content) {
  if ($group_content
    ->getEntity()
    ->getEntityTypeId() == 'user') {
    if ($group_content
      ->bundle() == $group_content
      ->getGroup()
      ->bundle() . '-group_membership') {
      _social_group_grant_admin_role($group_content
        ->getEntity()
        ->id(), $group_content
        ->getGroup()
        ->id());
    }
  }
}