Metadata, Triggers and Expiry

Hi everyone!


In a nutshell:

Im trying to create a document uploader that allows users to specify a time when the document will no longer be visible on the website.

e.g. upload movie timetable for a week and it is removed from the website after the week is up



Im having a bit of trouble with the triggers (setting them up to only affect 1 folder and subcontent), how to include the time that the document should 'expire' via the asset builder tool. I want the user to define when the document should expire and then the trigger will change its status so that is it no longer visible (e.g. Under Construction).







Any help would be great (especially step-by-step :smiley: )

[quote]
Hi everyone!



In a nutshell:

Im trying to create a document uploader that allows users to specify a time when the document will no longer be visible on the website.

e.g. upload movie timetable for a week and it is removed from the website after the week is up



Im having a bit of trouble with the triggers (setting them up to only affect 1 folder and subcontent), how to include the time that the document should 'expire' via the asset builder tool. I want the user to define when the document should expire and then the trigger will change its status so that is it no longer visible (e.g. Under Construction).



Any help would be great (especially step-by-step :smiley: )

[/quote]

Welcome to the MySource Matrix Forum chickensoup.



The "expiry time" can be configured with a combination of a Metadata Time event, which performs actions based on Metadata Date Field,

and then a Set Asset Status Trigger Action to place the page Under Construction. This part is all done within a Trigger.



A Metadata Date Field will need to be assigned to each asset via a Metadata Schema to start you off (in fact Asset Builder Pages

can assign this schema for you if it's not already cascaded). Then populate the date when building the asset.



Please note that the Metadata Time event has a resolution of 15 minutes, so expiry times within this period will only be affected

on each quarter hour.

Thanks heaps Mark!


Really helped me lot to understand what happens. Plus awesome response time :slight_smile:





Cheers

[quote]
Thanks heaps Mark!



Really helped me lot to understand what happens. Plus awesome response time :slight_smile:

[/quote]

No probs :wink:

Hi Guys,


Just a quick, semi-related question. I've a similar setup, metadata date field, metadata time trigger condition… basically an editor will set a 'go live' date and once the asset has completed workflow, it uses this to set a future status. If the date entered has already passed when workflow has been completed it sets the status to live immediately.



The asset should be picked up by the condition regardless of how ridiculous the date is or the display format used, yeah? 1 Jan 1970 would be picked up when the trigger event is fired… but for one reason or another it's not… the trigger itself fires fine without the metadata time trigger.



Any ideas what this could possibly be? First thought is maybe PHP config?

Hi rugi,

[quote]

The asset should be picked up by the condition regardless of how ridiculous the date is or the display format used, yeah? 1 Jan 1970 would be picked up when the trigger event is fired… but for one reason or another it's not… the trigger itself fires fine without the metadata time trigger.[/quote]



The Metadata Time condition (and more correctly, the Metadata Triggers Cron Job) should not be picky about the format of the date field when it determines what to fire upon, from what I've had a look at.



For the Set Future Status action however, if you are basing the future status' time on a metadata field, the Format attribute of the field needs to be "Y-m-d H:i:s" (without the quotes - thereby giving the ISO8601-ish date format like "2010-04-01 16:58:35") for it to work - AFAIK, this is so it can support both Text and Datetime fields that may have these values, so the formatted value is used in this action. It may be this that is causing problems, rather than the Metadata Time condition.



Has a "cron_errors.log" been created in your data/private/logs directory, when the Cron run script has been running - and if so, are there any entries which may indicate the Metadata Time-based trigger executing, but failing? (Keep in mind that for Metadata Time events to be triggered, you need the Cron script correctly set up in your system's Crontab, as per the Installation Guide.)

[quote]
For the Set Future Status action however, if you are basing the future status' time on a metadata field, the Format attribute of the field needs to be "Y-m-d H:i:s" (without the quotes - thereby giving the ISO8601-ish date format like "2010-04-01 16:58:35")

[/quote]



This is exactly what was causing the issue, thanks heaps - that was a real hair puller! :slight_smile:

THANK YOU!! I've been looking into this exact concept too, and this is the answer I needed! :slight_smile: