You are here

function gprofile_load_by_member in Group 7

Load all group member profiles for a given membership.

Parameters

int $mid: The GroupMembership id to load the profiles for.

string $type: (optional) The GProfileType name to filter on.

Return value

array An array of GProfile entities, keyed by their profile ids.

2 calls to gprofile_load_by_member()
gprofile_group_membership_delete in modules/gprofile/gprofile.entity.inc
Implements hook_group_membership_delete().
gprofile_load in modules/gprofile/helpers/gprofile.entity.inc
Load a group member profile.

File

modules/gprofile/helpers/gprofile.entity.inc, line 55
Entity API related helper functions for group member profiles.

Code

function gprofile_load_by_member($mid, $type = NULL) {
  $query = new EntityFieldQuery();
  $query
    ->entityCondition('entity_type', 'gprofile');
  $query
    ->propertyCondition('mid', $mid);
  if (!empty($type)) {
    $query
      ->propertyCondition('type', $type);
  }
  $result = $query
    ->execute();
  return isset($result['gprofile']) ? gprofile_load_multiple(array_keys($result['gprofile'])) : array();
}