Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Fix for Days_Old plugin running under Links 3.0.3 ?

Quote Reply
Fix for Days_Old plugin running under Links 3.0.3 ?
Hi All!

I just recently upgraded from Links SQL 2.2.1 => 3.0.3 without many major problems. The only thing I'm still having a issue with is the Days_Old plugin. After the upgrade it's no longer working. I've played with the code, searched the forums, and had no luck.

Anyone ran into the same problem? Know of a fix and/or have and clue as to what might be wrong?

Thanks for any help!


Code Snip:

package Plugins::Days_Old;
# ==================================================================
use strict;
use GT::Plugins qw/STOP CONTINUE/;
use Links qw/$IN $DB $TPL/;
use GT::Date;

sub link {
# -------------------------------------------------------------------
# This subroutine will get called whenever the hook 'site_html_link'
# is run. You should return STOP if you don't want
# the regular code to run, or CONTINUE if you want
# the regular code to run.
#
my $link = shift;

# added line to preserve Add_Date from Links table row
$link->{Add_Date1} = $link->{Add_Date} ;

# Links Days_Old calculate
# Figure out how many days old it is if it's a new link.

if ($link->{'isNew'} eq 'Yes') {
$link->{'Days_Old'} = GT::Date::date_diff ( GT::Date::date_get(), $link->{'Add_Date1'});
}
else {
$link->{'Days_Old'} = '';
}
return $link;
}


sub subcategory {
# -------------------------------------------------------------------
# This subroutine will get called whenever the hook 'site_html_print_cat'
# is run. You should return STOP if you don't want
# the regular code to run, or CONTINUE if you want
# the regular code to run.
#

my $subcat = shift;
my $cat_db = $DB->table('Category');

for (my $x=0;$x<scalar(@$subcat);$x++) {
my $cat_r=$subcat->[$x];

# Calculate the number of days old.
if ($cat_r->{'Has_New_Links'}) {
$cat_r->{'Days_Old'} = GT::Date::date_diff (GT::Date::date_get(), $cat_r->{'Newest_Link'});
}
else { $cat_r->{'Days_Old'} = ''; }

}
return $subcat;
}
Subject Author Views Date
Thread Fix for Days_Old plugin running under Links 3.0.3 ? Jonze 2159 Jun 19, 2005, 5:54 PM
Thread Re: [Jonze] Fix for Days_Old plugin running under Links 3.0.3 ?
Andy 2146 Jun 20, 2005, 12:57 AM
Post Re: [Andy] Fix for Days_Old plugin running under Links 3.0.3 ?
Jonze 2102 Jun 20, 2005, 11:22 AM
Post Re: [Andy] Fix for Days_Old plugin running under Links 3.0.3 ?
Jonze 2109 Jun 20, 2005, 4:33 PM
Thread Re: [Andy] Fix for Days_Old plugin running under Links 3.0.3 ?
Jonze 2100 Jun 20, 2005, 5:35 PM
Thread Re: [Jonze] Fix for Days_Old plugin running under Links 3.0.3 ?
pugdog 2077 Jun 20, 2005, 9:48 PM
Post Re: [pugdog] Fix for Days_Old plugin running under Links 3.0.3 ?
Jonze 2074 Jun 21, 2005, 1:46 PM