diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index b3fb991da..587b44d5c 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -1,7 +1,7 @@ 6.8.3 - fixed a problem with enabling Avatars in the Collaboration System. - - fixed a problem with op=editUser where it would use profile field - values of the current user. + - Fixed a problem where profile data would be mixed between the current user + and the user your viewing the profile of. - fix [ 1381551 ] epochToHuman for foreign languages - fix [ 1381305 ] SQLReports report nothing!!! - fix [ 1381873 ] Matrix missing toolbar diff --git a/lib/WebGUI/DateTime.pm b/lib/WebGUI/DateTime.pm index d4d341628..815b73a95 100644 --- a/lib/WebGUI/DateTime.pm +++ b/lib/WebGUI/DateTime.pm @@ -653,7 +653,7 @@ A string in the format of YYYY-MM-DD or YYYY-MM-DD HH:MM:SS. sub setToEpoch { my $set = shift; - return undef unless defined $set; + return undef unless $set; my $parser = DateTime::Format::Strptime->new( pattern => '%Y-%m-%d %H:%M:%S' ); my $dt = $parser->parse_datetime($set); unless ($dt) { @@ -662,8 +662,6 @@ sub setToEpoch { } # in epochToSet we apply the user's time zone, so now we have to remove it. $dt->set_time_zone($session{user}{timeZone}|| "America/Chicago"); # assign the user's timezone -# my $u = WebGUI::User->new(1); -# $dt->set_time_zone($u->profileField("timeZone")); # convert to the visitor's or default time zone return $dt->epoch; } diff --git a/lib/WebGUI/Operation/Profile.pm b/lib/WebGUI/Operation/Profile.pm index fdd49ace6..4e2239b84 100644 --- a/lib/WebGUI/Operation/Profile.pm +++ b/lib/WebGUI/Operation/Profile.pm @@ -164,7 +164,7 @@ sub www_viewProfile { next if ($field->get("fieldName") eq "email" && !$u->profileField("publicEmail")); push(@array, { 'profile.label' => $field->getLabel, - 'profile.value' => $field->formField({dataDefault => $u->profileField($field->getId)},2) + 'profile.value' => $field->formField(undef,2,$u) }); } } diff --git a/lib/WebGUI/Operation/User.pm b/lib/WebGUI/Operation/User.pm index 746ea3207..0be2588b5 100644 --- a/lib/WebGUI/Operation/User.pm +++ b/lib/WebGUI/Operation/User.pm @@ -279,9 +279,7 @@ sub www_editUser { foreach my $field (@{$category->getFields}) { next if $field->getId =~ /contentPositions/; my $label = $field->getLabel . ($field->isRequired ? "*" : ''); - # hack to get op=editUser to display the correct stuff. - $session{form}{$field->getId} = $u->profileField($field->getId); - $tabform->getTab("profile")->raw($field->formField({label=>$label},1)); + $tabform->getTab("profile")->raw($field->formField({label=>$label},1,$u)); } } my @groupsToAdd = WebGUI::FormProcessor::group("groupsToAdd"); diff --git a/lib/WebGUI/ProfileField.pm b/lib/WebGUI/ProfileField.pm index 776c1603a..3c1aa5090 100644 --- a/lib/WebGUI/ProfileField.pm +++ b/lib/WebGUI/ProfileField.pm @@ -106,7 +106,7 @@ sub delete { #------------------------------------------------------------------- -=head2 formField ( [ formProperties, withWrapper] ) +=head2 formField ( [ formProperties, withWrapper, userObject ] ) Returns an HTMLified form field element. @@ -118,6 +118,10 @@ Optionally pass in a list of properties to override the default properties of an An integer indicating whether to return just the field's form input, or the field with a table label wrapper (1), or just the field value (2). +=head3 userObject + +A WebGUI::User object reference to use instead of the currently logged in user. + =cut sub formField { @@ -137,7 +141,9 @@ sub formField { my $default; if ($session{form}{$properties->{name}}) { $default = $session{form}{$properties->{name}}; - } elsif ($session{user}{$properties->{name}}) { + } elsif (defined $u && $u->profileField($properties->{name})) { + $default = $u->profileField($properties->{name}); + } elsif (!defined $u && $session{user}{$properties->{name}}) { $default = $session{user}{$properties->{name}}; } else { $default = WebGUI::Operation::Shared::secureEval($properties->{dataDefault});