Gossamer Forum
Quote Reply
global question
I have the following global to determine the age of a user:
Code:
sub {
my ($rec) = @_;
my $age;
my $day;
my $month;
my $year;
my $birthyear = $rec->{'BirthYear'};
my $birthmonth = $rec->{'BirthMonth'};
my $birthday = $rec->{'BirthDay'};
my $date = GT::Date::date_get();
($year, $month, $day) = split(/-/, $date);
$age = $year - $birthyear;
if ($month < $birthmonth) {
$age = $age - 1;
}
if ($month = $birthmonth) {
if ($day < $birthday) {
$age = $age - 1;
}
}

return $age;
}

It works great...if you are logged in. My question is two-fold:
1. If you are not logged in, the age shows the current year (e.g., 2008). I am using other globals that work properly without logging in so is there something here that could be fixed to work for guests?

2. If you are logged in, the age global displays the correct date in all places except when called in the link.html loop by modify.cgi. Then you get some odd string like 20080206008755. Back to the first part...is there something inherent in the above global that needs to be fixed to be more stable?

TIA,
Kevin

My Green Promise: To learn (and practice) as much as I can about living a sustainable life and then spreading the word.
What's your Green Promise?
Subject Author Views Date
Thread global question kthull 6390 Feb 5, 2008, 10:07 PM
Thread Re: [kthull] global question
kthull 6242 Feb 5, 2008, 10:13 PM
Thread Re: [kthull] global question
tandat 6245 Feb 5, 2008, 10:45 PM
Thread Re: [tandat] global question
kthull 6260 Feb 5, 2008, 10:53 PM
Thread Re: [kthull] global question
Andy 6272 Feb 5, 2008, 11:37 PM
Thread Re: [Andy] global question
kthull 6228 Feb 5, 2008, 11:43 PM
Thread Re: [kthull] global question
Andy 6263 Feb 6, 2008, 12:20 AM
Thread Re: [Andy] global question
kthull 6235 Feb 6, 2008, 5:30 AM
Thread Re: [kthull] global question
Andy 6223 Feb 6, 2008, 5:34 AM
Post Re: [Andy] global question
kthull 6279 Feb 6, 2008, 5:43 AM