finally fixed the dang User.pm bug.

This commit is contained in:
Matthew Wilson 2006-01-16 23:07:56 +00:00
parent 09483e18c5
commit 4b4ddd768c

View file

@ -477,28 +477,28 @@ sub new {
my %profile = $session->db->buildHash("select userProfileField.fieldName, userProfileData.fieldData my %profile = $session->db->buildHash("select userProfileField.fieldName, userProfileData.fieldData
from userProfileField, userProfileData where userProfileField.fieldName=userProfileData.fieldName and from userProfileField, userProfileData where userProfileField.fieldName=userProfileData.fieldName and
userProfileData.userId=".$session->db->quote($user{userId})); userProfileData.userId=".$session->db->quote($user{userId}));
my %default = $session->db->buildHash("select fieldName, dataDefault from userProfileField"); my %default = $session->db->buildHash("select fieldName, dataDefault from userProfileField");
foreach my $key (keys %default) { foreach my $key (keys %default) {
my $value; my $value;
if ($profile{$key} eq "" && $default{$key}) { if ($profile{$key} eq "" && $default{$key}) {
$value = eval($default{$key}); $value = eval($default{$key});
if (ref $value eq "ARRAY") { if (ref $value eq "ARRAY") {
$profile{$key} = $$value[0]; $profile{$key} = $$value[0];
} else { } else {
$profile{$key} = $value; $profile{$key} = $value;
} }
} }
} }
$profile{alias} = $user{username} if ($profile{alias} =~ /^\W+$/ || $profile{alias} eq ""); $profile{alias} = $user{username} if ($profile{alias} =~ /^\W+$/ || $profile{alias} eq "");
$userData = { $userData = {
_userId => $userId, _userId => $userId,
_user => \%user, _user => \%user,
_profile => \%profile _profile => \%profile
}; };
$cache->set($userData, 60*60*24); $cache->set($userData, 60*60*24);
$userData->{_session} = $session; }
} $userData->{_session} = $session;
bless $userData, $class; bless $userData, $class;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -607,6 +607,7 @@ Deletes this user object out of the cache.
sub uncache { sub uncache {
my $self = shift; my $self = shift;
use Data::Dumper;print "<br /><br /> HOO HOO ".Dumper($self->session);
my $cache = WebGUI::Cache->new($self->session,["user",$self->userId]); my $cache = WebGUI::Cache->new($self->session,["user",$self->userId]);
$cache->delete; $cache->delete;
} }