function panels_content_user_profile in Panels 6.2
Same name and namespace in other branches
- 5.2 content_types/user_profile.inc \panels_content_user_profile()
1 string reference to 'panels_content_user_profile'
- panels_user_profile_panels_content_types in content_types/
user_profile.inc - Callback function to supply a list of content types.
File
- content_types/
user_profile.inc, line 18
Code
function panels_content_user_profile($subtype, $conf, $panel_args, $context) {
$account = isset($context->data) ? drupal_clone($context->data) : NULL;
$block = new stdClass();
$block->module = 'term-list';
if ($account === FALSE || $account->access == 0 && !user_access('administer users')) {
return drupal_not_found();
}
// Retrieve and merge all profile fields:
$fields = array();
foreach (module_list() as $module) {
if ($data = module_invoke($module, 'user', 'view', '', $account)) {
foreach ($data as $category => $items) {
foreach ($items as $key => $item) {
$item['class'] = "{$module}-" . $item['class'];
$fields[$category][$key] = $item;
}
}
}
}
// Let modules change the returned fields - useful for personal privacy
// controls. Since modules communicate changes by reference, we cannot use
// module_invoke_all().
foreach (module_implements('profile_alter') as $module) {
$function = $module . '_profile_alter';
$function($account, $fields);
}
$block->title = check_plain($account->name);
$block->content = theme('user_profile', $account, $fields);
return $block;
}