Adding expiration to custom module (directory) items

Oct 16, 2014 9:59 am

You can make custom module items expire with a custom field and a report.

1. In Green > Toolbar, when editing the custom module, create a new field for the expiration date:

2. In Blue, set an expiration date for each item using that field.

3. Go to Orange > Reports, create a report that runs daily to set items to inactive if the date is older than the current day.

Here is the SQL to put in the report:

UPDATE directory_items
SET visible="no"
WHERE type="UNIQUE_ID"
AND DATE(misc0)<DATE(NOW());
SELECT * FROM directory_items
LIMIT 1

notes:
Replace UNIQUE_ID with the unique ID of the custom module
Replace misc0 with whatever field is your expiration date