Hey everyone.
I have this problem. I’m creating sort of calendar to my page. I know how to use ditto to make few future events to show where ever I want, BUT . . How can I make a document delete itself automatically when the current date has passed???
I’m sure this is a simple problem, but somehow I can’t find anything written about it.
I don’t think that you can auto delete documents (without using some sort of custom script and a cron to execute at a specified interval). However you can use the unpublish date to schedule for the document to become unpublished and keep it off the site.
-
MODX Staff
- 10,725 Posts
Personally, I wouldn’t want it deleted, just hidden from the views where I show the current events. I created an xPDO-based calendar system that does this in the view snippet via a configuration or query string parameter; I’m sure you can do the same thing with regular documents and Ditto simply by limiting the Ditto output by date. Then you’re past events could be shown in a separate view, a.k.a. an archive.
-
MODX Staff
- 2,502 Posts
This is partly what I am trying to achieve with the plugin I am working out over here:
http://modxcms.com/forums/index.php/topic,19893.0.html
I have managed to get the data from the TV event_date which is a unixtime timestamp. I hope to be able to have the plugin automatically set the unpub_date so that it no longer appears on the front end. It may require addition of a function to hide the documents or move them to another folder in the tree.
Hope this helps.
Jay
Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup
magician.
Blog ✦
Twitter ✦
LinkedIn ✦
GitHub