Setting Content to Expire

Topics: Customizing Orchard
Aug 12, 2011 at 10:13 AM

Hi,

I'm creating an orchard site which has a list of events, I've added a datetime field to show when the event is on. I want to add another field(?) that hides the content the day after the event. For example, if Event One happens at 09:30 on 12/12/2011 then as soon as the date passes to 13/12/2011 the Event is hidden. Is there a way to do this or would I need to resort to writing my own module to do this?

Thanks 

K

Aug 12, 2011 at 11:57 AM

Hi,

I suppose you could do this in the view with a check on today's date and to show/hide the events but I would suggest a module would be more efficient. There is an example events module in the gallery. Have you looked at that?

thanks

Aug 12, 2011 at 12:01 PM

Sorry, the one in the gallery is just an event date: http://orchardproject.net/Gallery/List/Modules/Orchard.Module.Alois.EventDate/1.0

Aug 12, 2011 at 12:15 PM

Hi,

Ok, I'll have to sit down and look at Modules!

Thanks

K

Aug 12, 2011 at 12:31 PM

Hi

Thinking about it you may be able to use the PublishLater and ArchiveLater parts together to achieve this but I'm not sure how you've set up your events.

thanks

Aug 12, 2011 at 12:52 PM

Hi,

I created a content type called diaryevent, added Item, Where and When fields, the When field being a DateTime field from the DateTimeField module. The diaryevents are then displayed in a List on a content page called Events! I added the ArchiveLater module but that seems to only add the option to manually unpublish items of content. Since events should expire almost every day, that wouldn't really help. Any ideas?

Thanks

K

 

Aug 12, 2011 at 1:03 PM

Hi,

If you are entering the event date when you create the event is it too much trouble to fill in the archive later date for the day after? Or even use the archive later date and just substract 1 day from it for the event date?

If you are looking for a more automated approach then i think you may have to create a module for it.  Tap into the scheduling module for help with it.

thanks

Aug 12, 2011 at 1:16 PM

Hi,

That would work, however I cannot see a way to add an archive later field to my diaryevent content type. What am I missing? I can add archive later as a part to the content type.

Thanks

K

Aug 12, 2011 at 1:37 PM

Hi,

Yes, you should be able to just add it to your custom type as a part.

thanks

Aug 12, 2011 at 1:54 PM

Hi,

Ok, done that but then what? As far as I can see there are no further options to make a diaryevent expire or add a date on which to archivelater? I tried creating a new Content Type but again no options. A little lost at the moment.

Thanks K

Aug 12, 2011 at 1:57 PM

Hi,

Ignore my last post. Logged out of the dashboard and back in, now archive later is shown!

Thanks for all your help.

K

Aug 12, 2011 at 2:02 PM

Cool.  Yes, be careful with caching in Orchard, I've noticed a recycle of the app pool normally solves my problems when I'm scratching my head.

Glad I could help.