Skip Navigation

[Resolved] Email for notify before post expiration not working correctly

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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 8 replies, has 2 voices.

Last updated by Nigel 1 year, 10 months ago.

Assisted by: Nigel.

Author
Posts
#2556259
Captura de Pantalla 2023-02-17 a la(s) 00.49.30.png
Captura de Pantalla 2023-02-17 a la(s) 00.48.41.png
Captura de Pantalla 2023-02-17 a la(s) 00.48.29.png
Captura de Pantalla 2023-02-17 a la(s) 00.48.10.png
Captura de Pantalla 2023-02-17 a la(s) 00.47.46.png

I am trying to:
I´ve configured a CRED form for submit posts, with a post expiration of 4 hours.
The form then, will send email notification to user before the post expiration in this way
72 hours before
48 hours before
24 hours before
Post is expires

Link to a page where the issue can be seen:
hidden link

I expected to receive Emails on that times i exposed before, instead I got all emails at the same time when making test

On my Toolset configuration, I've configured the cron to be every 5 minutes.
For testing purposes, I´ve chosen to send notifications:
4 hours before
3 hours before
2 hours before
1 minute before (Post expiration message, that I cannot see how to configure this if post change status to bin)

Im sending captures on my configuration and log emails

Hope for your help

#2556595

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Sorry, before looking into this further, I'm a bit confused.

You say posts have a post expiration of 4 hours and yet you want pre-expiration notices 72 hours, 48 hours etc., i.e. before the post has even been created.

You are testing shorter durations, too.

One thing I would point out that might explain why you receive some notifications at the same time is that WordPress cron jobs are only triggered if there is some activity on the site.

If you have a cron job that is due to run at 10:00am but no-one visits the site until 11:00am then the queued cron jobs will run at 11:00am and not before, which can mean jobs running at the same time that were intended to run at different intervals. Please bear that in mind when testing.

#2558253

Hi Nigel

Thanks for your answer
Let's see. Originally, I would need the site to notify the user before expiration post at:
72, 48, 24 hours and also in post expiration.

But, ONLY for testing purposes, Im using 4 hours for post expiration and hope to be notified
3, 2, 1 hours and also in post expiration (Im using 1 minute because I haven't found an option to send email when post change status to trash, which is the status I've chosen after post expires).

I'm a little confused about the cron jobs and notifications setting up.

So, you mean, if nobody visits the website that cron jobs are not going to trigger?
If so, is that a way that it triggers even if is no one visiting the site?

I.E: Users may post a property on the site, but its possible they are not visiting the site, even so, I have the need for the users to get notification about their post expiration.

Just to be clear, when I received my email notifications (4 emails at the same time) I was connected to the site and working!

Hope to hear from you

#2558509

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

>if nobody visits the website that cron jobs are not going to trigger?

That's correct, that's how scheduled tasks work in WordPress: https://developer.wordpress.org/plugins/cron/

Note, though, any site visit will trigger all all relevant scheduled tasks. Just to avoid confusion, it doesn't have to be the person that posted a post who visits the site to trigger the notifications.

If your site has a reasonable amount of traffic this won't be an issue, but if you have very few site visitors then notifications may be sent later than expected.

I'm just doing some testing myself at the moment to check that these notification emails are working as intended.

I'll update you when I've completed that.

#2558795

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Just to let you know that my tests haven't worked very well today, so I'm going to have to dig deeper into the code execution to try and identify why not, and I'll undertake that tomorrow.

#2559509

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I confirmed in my testing that when you include multiple notifications for when a post is due to expire (e.g. 72 hours before, 48 hours before, 24 hours before) then the earlier notifications will get sent multiple times (e.g. when there are only 24 hours left before expiry all 3 of the above notifications would get sent).

I have escalated this to the developers and I'll let you know when I get some feedback from them.

By the way, if you want to send a notification when the post expires, and you have set the form so that the post becomes a draft upon expiry, then you can send a notification when the post status changes to draft.

#2562377

HI Nigel

Thanks, Im waiting for the developers feedback.

I am aware thats a way to get a notification when post status is draft. My issue is that Im using the status "draft" for another process. so when the post is not approved by the admin, the draft status means that needs to be corrected by the user.

So, in my case will not work. Another workaround you can think of?

Thanks

#2562913

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

The developer has already produced a fix for the notifications problem, it will go out with the next Forms update (I expect a round of plugin updates within a few weeks).

You could perhaps use the pending review status for one of your workflows, and draft for the other, and your form notification for the post having expired being based upon which status you choose for the form expiration setting.

#2582271

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

I wanted to let you know that we published plugin updates today that include a fix for this issue.

If the updates do not show up on your plugin installer page (click the registered link beneath the plugin name to go to the custom installer page) click the the Check for Updates button to update the list.

Or you can download the latest versions from your accounts page: https://toolset.com/account/downloads