Gossamer Forum
Home : Products : DBMan : Customization :

Just one question...

Quote Reply
Just one question...
Hi! I noted this little mod that JPDeni wrote sometime ago. It allows admin to autodelete records after a certain number of days after a record is added or modified. However, I would like it to do something more. What I would like is that 7 days before the deletion date, a mail is sent out to the user telling him that if he does not modify his record in 7 days, his record will be deleted. Then the database will then not delete the record until the 7 days has passed or if the user has modified the record.

It does not need to be automatic as in it does not have to run automatically but rather if it can be triggered when I click on a link. Is this possible? Am I asking for the sky? :) Just to help things a bit, below is the mod that was written by JPDeni

sub auto_delete {
$days = 30;
$time = time() - ($days * 86400);
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime($time);
my (@months) = qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
($day < 10) and ($day = "0$day");
$year = $year + 1900;
$in{'Date-lt'} = $day-$months[$mon]-$year";
open(FILE, "< $db_file_name") or &cgierr("can't open $db_file_name: $!");
$count++ while <FILE>;
close FILE;
$in{'mh'} = $count;
my ($status,@hits) = &query("mod");
for (0 .. $db_total_hits - 1) {
%tmp = &array_to_hash($_, @hits);
$in{$tmp{$db_key}} = "delete";
}
&delete_records;
}

Thanks.

Julian