Hi,
I am trying to make a plugin for adding/calculating an expiration date for links. Therefore, when you are adding your link, based on the date_posted and the duration you select, expiration date field is calculated and updated.
So, I started from the 'user_link_add' hook, and decided to have a PRE hook on 'user_link_add' that takes looks like:
###################
use strict;
use GT::Plugins qw/STOP CONTINUE/;
use Links qw/$IN $DB $USER $CFG $TPL/;
use GT::Date;
sub set_expiration {
my $input = $IN->get_hash;
my $duration = $input->{'AdDuration'};
Links::init_date();
my $today = GT::Date::date_get();
$input->{Add_Date} = $today;
$input->{Exp_Date} = add_date($today, $duration);
$input->{AdRenew} = 0;
return $input;
}
################
Guess what - it does not work - and I figured that I'm not getting/passing the right arguments/hash...what now?
Thanks - any help very appreciated.
Masamoda :)
I am trying to make a plugin for adding/calculating an expiration date for links. Therefore, when you are adding your link, based on the date_posted and the duration you select, expiration date field is calculated and updated.
So, I started from the 'user_link_add' hook, and decided to have a PRE hook on 'user_link_add' that takes looks like:
###################
use strict;
use GT::Plugins qw/STOP CONTINUE/;
use Links qw/$IN $DB $USER $CFG $TPL/;
use GT::Date;
sub set_expiration {
my $input = $IN->get_hash;
my $duration = $input->{'AdDuration'};
Links::init_date();
my $today = GT::Date::date_get();
$input->{Add_Date} = $today;
$input->{Exp_Date} = add_date($today, $duration);
$input->{AdRenew} = 0;
return $input;
}
################
Guess what - it does not work - and I figured that I'm not getting/passing the right arguments/hash...what now?
Thanks - any help very appreciated.
Masamoda :)