You are here

function _social_group_get_member_profile in Open Social 8.9

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

Return user profile by given group membership content.

Parameters

\Drupal\group\Entity\GroupContent $group_content: Group content entity.

Return value

\Drupal\profile\Entity\Profile Returns the Profile entity for the member.

1 call to _social_group_get_member_profile()
social_group_views_post_render in modules/social_features/social_group/social_group.module
Implements hook_views_post_render().

File

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

Code

function _social_group_get_member_profile(GroupContent $group_content) {
  $user_profile = NULL;

  // Get User entity.
  $user_entity = $group_content
    ->getEntity();
  if (!empty($user_entity)) {

    // Get Profile storage.
    $storage = \Drupal::entityTypeManager()
      ->getStorage('profile');
    if (!empty($storage)) {

      // Get Profile entity.
      $user_profile = $storage
        ->loadByUser($user_entity, 'profile');
    }
  }
  return $user_profile;
}