Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Basic Expire 1 year.

Quote Reply
Basic Expire 1 year.
Hi,

I'm out of cash so am going this one alone! :) What I want to do is add a basic expire time/function to the links when added. If it looks like I'm heading in the wrong direction with this one I'd appreciate the comments.

All of the links in my directory are added by the administrator, through the admin area. So, this was how I thought it would work to exclude all links that are over 1 year old from the build and have Expire set to Yes (those with Expire set to No don't expire).

1. Add a new field to Links - Expire Yes|No
2. Add a new timestamp field to Links
3. Every link added gets a timestamp of now()
4. When building the directory, the build includes only those links with an expire time > (now() - 1 year) and Expire = Yes, and all those with Expire = No. (is this possible in the same query?)

Does that look like I'm doing it the right way, or is there an easier solution anyone can think of?

Cheers,
Regan.


Quote Reply
Re: Basic Expire 1 year. In reply to
Hi,

Do you also need to exclude them from search results and user modify?

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Basic Expire 1 year. In reply to
Hi Alex,

Yip, they need to be excluded from everything. Thinking last night, I'd also need a way to reset the timestamp after the year is up if they renew for another, which may require me doing it another way?

Cheers,
Regan.

Quote Reply
Re: Basic Expire 1 year. In reply to
Thinking about this some more, I've come up with a simplier solution...

I have added a date field to the links table, and will use that to expire my links. I'll enter a particular date (in the future) into that field when adding the link. Then what I need to happen when doing a build/search etc is:

- EXCLUDES ALL links older than today() in expire field
- INCLUDES ALL links with an expire date in the future
- INCLUDES ALL links set to 0000-00-00

I tried adding this into Build.pm at line 519:

ExpireDate => '0000-00-00'

and it did build all the links with that date. What I need to know though is what sql, and where, I'd need to alter to make the build/search etc check my ExpireDate field?

Cheers,
Regan.


Quote Reply
Re: Basic Expire 1 year. In reply to
Hi,

You know what you might want to do instead, is to add the Expiry Date, then on a daily schedule, set all links with Expiry Date < NOW() to isValdated = No. Then Links SQL will not display or search on unvalidated links.

The only other concern is that these links now show up in the validate screen (however you were saying that they are all admin added anyways, so this might not be an issue).

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Basic Expire 1 year. In reply to
Brilliant!

I'll try and write a small script that does it.

Cheers Alex!

Regan.