3

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?

1 Answer 1

7

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.

5
  • 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
    Commented Dec 16, 2012 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
    Commented Dec 17, 2012 at 0:47
  • Perfect solution! Thank you for reporting back.
    – Anna_MediaGirl
    Commented Dec 17, 2012 at 1:22
  • @Anna_MediaGirl this auto expire plugin no longer works in EE2.8, have you seen a patch floating somewhere? Commented May 25, 2014 at 11:30
  • I haven't seen a patch unfortunately.
    – Anna_MediaGirl
    Commented May 27, 2014 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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