If some of public user profile fields are empty, instead of showing nothing, the user list displays values of a previously listed user. The problem is in the the folloiwing function, where $fields argument is already initialized to previous user values.
/**
* Helper function: update an array of user fields by calling profile_view_field
*/
function _profile_update_user_fields($fields, $account) {
foreach ($fields as $key => $field) {
if ($value = profile_view_field($account, $field){
$fields[$key]->value = $value;
}
}
return $fields;
}
A quick fix is to change the if line to if (($value = profile_view_field($account, $field)) || $value == ''). However, the if clause could probably be eliminated altogether. In that case, the whole function might be redundant.
Comments
Comment #1
darius commentedThis issue is still there in 4.7-beta 4. Patch still applies to CVS version.
Darius
Comment #2
dries commentedIMO, this needs fixing in the caller.
Comment #3
darius commentedOK, how about this patch?
Darius
Comment #4
Barogio commenteddarius that patch works however there are other references to the same function in profile.module so those might need to be changed also.
Comment #5
darius commentedI think the other two references deal with listing a single user's data (as opposed to going through the list of users), so those cases are fine. The bug manifests itself when
$fieldsarray retains previous user's data when going through a list of users.Comment #6
moshe weitzman commentedlooks right to me. i didn't test but is trivial.
Comment #7
dries commentedCommitted. Thanks.
Comment #8
(not verified) commented