Closed (fixed)
Project:
Drupal core
Version:
5.x-dev
Component:
user.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Jan 2007 at 10:42 UTC
Updated:
6 Mar 2009 at 12:30 UTC
On line 1503 there is a foreach() within the user_view function which is erroring if that array is empty, so i have wrapped this in an if statement to avoid any unnecessary errors.
function user_view($uid = 0) {
global $user;
$account = user_load(array('uid' => $uid));
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)) {
if ( is_array($data) ) {
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);
}
drupal_set_title($account->name);
return theme('user_profile', $account, $fields);
}
Comments
Comment #1
mr.baileysThis has long since been resolved, cleaning up old issues...