You are here

function gprofile_group_membership_view in Group 7

Implements hook_group_membership_view().

Add the member's profiles to the group membership view.

File

modules/gprofile/gprofile.entity.inc, line 233
Contains all Entity API functions for the Group member profiles module.

Code

function gprofile_group_membership_view(GroupMembership $group_membership, $view_mode, $langcode) {
  if (!empty($group_membership->profiles)) {
    $group = group_load($group_membership->gid);
    $account = user_load($group_membership->uid);
    foreach (gprofile_load_multiple($group_membership->profiles) as $gprofile) {
      if (group_access("use {$gprofile->type} profile", $group, $account)) {
        $group_membership->content["profile_{$gprofile->type}"] = $gprofile
          ->view('full', NULL, TRUE);
      }
    }
  }
}