Skip Navigation

[Resolved] Triggering email when post expires

This support ticket is created 5 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#1213625

Hi - I am following instructions sent by Wuqar - Reply https://toolset.com/forums/topic/automatic-email-at-xxxx-time-if-not-turned-off/#post-1185891

I am creating a web site which will alert police if a bush walker doesn't return on time.

They enter a date/time. If they don't login and update it, an email will go to police.

In the instructions he says to add a "cred_save_data" hook for the date/time. Then he said -
In the form's setting, you can set an email notification that should fire, when the post expires (i.e. the user hasn't returned in time).

However the setting is not available - how can I trigger the email? The setting is only available if I tick "Set expiration date XX hours after publishing the post" but this is not what I want.

thank you.

#1213755

However the setting is not available - how can I trigger the email? The setting is only available if I tick "Set expiration date XX hours after publishing the post" but this is not what I want.
You'll have to set that option in the Form builder, then the cred_save_data hook will override whatever you selected.

One thing I want to point out here is that the Forms notification system runs on the WordPress cron, not a standard cron. The difference is a standard cron runs on the server at some specified interval without any interaction from your site. The WordPress cron is only triggered by a request to the site, and then the WordPress system looks at all the crons it has registered and determines if any of them should be run based on the last time the cron was run. This can cause notification delays if your site doesn't have heavy traffic, because the expiration time interval may pass during inactivity. In real-world terms, this would mean that the email to police isn't triggered until someone visits the site after the cron interval has elapsed. You can get around this by setting up a standard cron on your server that "pings" the site periodically to trigger the WordPress cron, once every half hour or so.