Take the 2-minute tour ×
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It's 100% free, no registration required.

I've got a SafeCracker form that contains (amongst other fields) an entry_date field and an expiration_date field:

<input type="text" name="entry_date" id="entry_date" value="{entry_date}" maxlength="23" size="25">
<input type="text" name="expiration_date" id="expiration_date" value="{expiration_date}" maxlength="23" size="25">

For this particular channel, I always want the expiration date to be exactly 24 hours after the entry date (and the user can change the entry date to be any date/time, not necessarily the current date/time). Is it possible make this happen automatically, without requiring the user to manually add/edit the expiration date?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

The Auto Expire addon should do the trick:
http://devot-ee.com/add-ons/auto-expire


Auto Expire adds the ability to any weblog to automatically expire new entries. It adds a predefined amount of time to the entry date. If an expiration date has already been set, that date will be used as the expiration date.

share|improve this answer
    
Thanks for the answer. Unfortunately, I can't use that add-on at this time as it needs hosting with PHP 5.3.0 onwards, and my current hosting is running 5.2.17 in order to keep support for some older sites. Also, I'd prefer to have a solution that worked in the SafeCracker form itself, so I'm thinking I might have do implement a JS solution for this. –  Stephen Dec 16 '12 at 1:03
    
For info, I've ended up using the DT Plugin (devot-ee.com/add-ons/dt-plugin) for this. It allows me to set a date (in this case, current_time) and add 1 day to that date for the expiry date. The plugin has a format parameter, so I can output the date to be in the format needed for the EE expiry_date and add this as a field on my SafeCracker form. –  Stephen Dec 17 '12 at 0:47
    
Perfect solution! Thank you for reporting back. –  Anna_MediaGirl Dec 17 '12 at 1:22
    
@Anna_MediaGirl this auto expire plugin no longer works in EE2.8, have you seen a patch floating somewhere? –  Dimitri Kouvdis May 25 at 11:30
    
I haven't seen a patch unfortunately. –  Anna_MediaGirl May 27 at 17:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.