Skip to content

Instantly share code, notes, and snippets.

@smerrill
Created March 23, 2013 18:40
Show Gist options
  • Save smerrill/5228927 to your computer and use it in GitHub Desktop.
Save smerrill/5228927 to your computer and use it in GitHub Desktop.
<?php
function get_profile_data_wrapper($uid) {
$query = new EntityFieldQuery;
$result = $query->entityCondition('entity_type', 'profile2')->entityCondition('bundle', 'main')->propertyCondition('uid', $uid)->execute();
if (!empty($result)) {
try {
$entity_info = current($result['profile2']);
$entity_wrapper = entity_metadata_wrapper('profile2', $entity_info->pid);
return $entity_wrapper;
}
catch (Exception $e) {
return FALSE;
}
}
return FALSE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment