- Fixed a problem where profile data would be mixed between the current user
and the user your viewing the profile of.
This commit is contained in:
parent
6944fe3316
commit
a16b470dd4
5 changed files with 13 additions and 11 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue