function content_profile_load_profile in Real Name 6
Implementation of hook_profile_load();
File
- ./
realname_content_profile.inc, line 23 - Realname module support for Content Profile module.
Code
function content_profile_load_profile(&$account, $type = NULL) {
$profile = content_profile_load($type, $account->uid);
if (!$profile) {
return;
}
$fields = content_fields(NULL, $type);
foreach ($fields as $field_name => $field_attributes) {
if (isset($profile->{$field_name})) {
$values = array();
$contents = $profile->{$field_name};
foreach ($contents as $content) {
if (isset($content['value'])) {
$values[] = $content['value'];
}
else {
$values[] = content_format($field_name, $content);
}
}
if (empty($account->{$field_name})) {
switch (count($values)) {
case 0:
$account->{$field_name} = NULL;
break;
case 1:
$account->{$field_name} = $values[0];
break;
default:
$account->{$field_name} = $values;
}
}
}
}
// $account->title = $profile->title; // http://drupal.org/node/606364
}