By jnunn on
Since upgrading to 5.5 I've not been able to update my account (user/1). When I click on my account, I get the following error message:
warning: Invalid argument supplied for foreach() in /www/drupal/modules/user/user.module on line 1526.
If I click on the "edit" link at the top of the page, I get a page not found error.
the code from user.module surrounding this line is (line 1526 is highlighted):
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)) {
foreach ($data as $category => $items) { <<<<<<<<<<----- LINE 1526
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(check_plain($account->name));
return theme('user_profile', $account, $fields);
}I've disabled modules that relate to the user.module, and it still appears. I tried to review information from previously submitted issues, but nothing seemed to provide an answer to this problem. Any assistance is welcome.
Regards,
James
Comments
Funky module ...
Looks like you have a funky module that is returning something naughty in it's user hook.
One way to figure out which module is to blame would be to modify your user.module (NOTE - THIS IS ONLY FOR DEBUGGING, MODIFYING ANY OF THE CORE DRUPAL MODULES IS GENERALLY A BAD IDEA - so don't forget to unmodify it when your done)
If you change the above bit of the user module to
That should then flag the bad module (I've commented out the code that was throwing the error so you won't get the white screen of death) ...
Good luck (and don't forget to keep a backup copy of your user module just incase)
Mike,
Computerminds offer Drupal development, consulting and training
Mike,
Computerminds offer Drupal development, consulting and training