Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

adding field that expires?

Quote Reply
adding field that expires?
Can someone help me out with how to achieve this...

I'd like to add a new field associated with every link - I'll call it FRED. When the link is added, FRED is automatically set to 0, or not active (I can do up to here ok).

Now I'd like the admin to be able to go into the admin area and bring up the link information. The admin can then change FRED to be active with a setting of 1, or 2, or 3, where 1 = one month after the date the admin sets it, 2 = two months after the date the admin sets it, 3 = three months after etc etc etc.

Then, if FRED is set to 1 (being one month after it was set), and that date is now here - it automatically expires and sets itself back to 0, or not active - which also stops the information in the html page from being displayed.

It would also need to keep the date the admin set even if the user modified their link information.

Hope thats clear - any ideas anyone?

Thanx. Regan.

Quote Reply
Re: adding field that expires? In reply to
Here are some suggestions:

1) Use the Expirator Mod for Links 2.0.

http://gossamer-threads.com/...521-nphexpirator.txt

Except rather than deleting the link, you will have to write an UPDATE statement that will update the "FRED" field.

Like the following:

Code:

UPDATE Links
SET ID = '$id',
FRED = '0',
WHERE ID = '$id'


$id would be defined as the Link ID that has been classified as FRED-1 and above. You would have to write a query statment that searches the Links table for Links with the 1 and above number and then verifies the current date with those numbers.

2) Write a stand-alone script similar to the Expirator Mod that checks the date (You will have to do some computational statements that defines the day to the number you are using in the admin script.)

In Reply To:
It would also need to keep the date the admin set even if the user modified their link information.
Very simple...

Add the following codes in the modify.cgi script:

Code:

$rec->{FRED} = $original->{FRED};


in the section of the script where the following codes are located:

Code:

$rec->{Add_Date} = $original->{Add_Date};


Then, of course, you would have to hack the nph-build.cgi script to only build links with the correct status...like the following:

Code:

if ($rec->{FRED} ne '0') {
&site_html_link;
}


Regards,

Eliot Lee