diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 029f5a071..68d80b28d 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -26,6 +26,7 @@ or no question answers are found. - fixed: Gateway problem with VendorPayout. - fixed #9976: carts not cleaned up + - fixed Problems with displaying the wrong name and/or creation in the Account, and all plugins. 7.7.1 - the AdSku project: create a Sku that allows buyers to purchase advertising in select AdSpaces at selected priorities diff --git a/lib/WebGUI/Account.pm b/lib/WebGUI/Account.pm index 75e713a74..5439b03d4 100644 --- a/lib/WebGUI/Account.pm +++ b/lib/WebGUI/Account.pm @@ -51,7 +51,7 @@ sub appendCommonVars { my $self = shift; my $var = shift; my $session = $self->session; - my $user = $session->user; + my $user = $self->getUser; $var->{'user_full_name' } = $user->getWholeName; $var->{'user_member_since'} = $user->dateCreated; @@ -281,8 +281,8 @@ the current module and do values will be used. =head3 appendUID -If this flag is set and uid is passed along the url, the uid passed in will be -appended to the end of it to the end of the url +If this flag is set and uid is passed as a URL param, that uid will be +appended to the end of the url. =cut @@ -292,8 +292,8 @@ sub getUrl { my $appendUID = shift; my $session = $self->session; - my $form = $session->form; + my $uid = $self->uid; if($pairs) { #Append op=account to the url if it doesn't already exist unless ($pairs =~ m/op=account/){ @@ -304,7 +304,6 @@ sub getUrl { $pairs = q{op=account;module=}.$self->module.q{;do=}.$self->method; } - my $uid = $self->uid; $pairs .= ";uid=".$uid if($appendUID && $uid); return $session->url->page($pairs); @@ -312,6 +311,25 @@ sub getUrl { #------------------------------------------------------------------- +=head2 getUser + +Gets the user, either specified by the uid URL parameter, or the +session user. + +=cut + +sub getUser { + my $self = shift; + if ($self->uid) { + return WebGUI::User->new($self->session, $self->uid); + } + else { + return $self->session->user; + } +} + +#------------------------------------------------------------------- + =head2 new ( session, module [,method ,uid] ) Constructor. diff --git a/lib/WebGUI/Account/Contributions.pm b/lib/WebGUI/Account/Contributions.pm index d143b3598..d5e38c671 100644 --- a/lib/WebGUI/Account/Contributions.pm +++ b/lib/WebGUI/Account/Contributions.pm @@ -226,12 +226,6 @@ sub www_view { $self->appendCommonVars($var); $p->appendTemplateVars($var); - #Overwrite these - my $user = WebGUI::User->new($session,$userId); - $var->{'user_full_name' } = $user->getWholeName; - $var->{'user_member_since' } = $user->dateCreated; - - return $self->processTemplate($var,$self->getViewTemplateId); } diff --git a/lib/WebGUI/Account/Friends.pm b/lib/WebGUI/Account/Friends.pm index 71fef60b2..e0b079efa 100644 --- a/lib/WebGUI/Account/Friends.pm +++ b/lib/WebGUI/Account/Friends.pm @@ -484,17 +484,13 @@ sub www_view { my $var = {}; my $uid = $self->uid; - my $user = ($uid) ? WebGUI::User->new($session,$uid) : $session->user; + my $user = $self->getUser; $self->appendCommonVars($var); my $displayView = $uid ne ""; $var->{'display_message'} = $msg; - #Override these - $var->{'user_full_name' } = $user->getWholeName; - $var->{'user_member_since' } = $user->dateCreated; - unless ($user->profileField('ableToBeFriend') && $user->profileIsViewable($session->user)) { my $i18n = WebGUI::International->new($session,"Account_Friends"); my $errorMsg = ""; diff --git a/lib/WebGUI/Account/Profile.pm b/lib/WebGUI/Account/Profile.pm index c46ffccdd..5f16d585c 100644 --- a/lib/WebGUI/Account/Profile.pm +++ b/lib/WebGUI/Account/Profile.pm @@ -107,13 +107,13 @@ sub appendCommonVars { my $self = shift; my $var = shift; my $session = $self->session; - my $user = $session->user; + my $user = $self->getUser; my $pageUrl = $session->url->page; $self->SUPER::appendCommonVars($var); $var->{'edit_profile_url' } = $self->getUrl("module=profile;do=edit"); - $var->{'invitations_enabled' } = $session->user->profileField('ableToBeFriend'); + $var->{'invitations_enabled' } = $user->profileField('ableToBeFriend'); $var->{'profile_category_loop'} = []; #Append the categories @@ -475,10 +475,6 @@ sub www_view { $self->appendCommonVars($var); - #Overwrite these - $var->{'user_full_name' } = $user->getWholeName; - $var->{'user_member_since' } = $user->dateCreated; - $var->{'profile_user_id' } = $user->userId; $var->{'can_edit_profile' } = $uid eq $session->user->userId; #Check user privileges