I've set-up email notifications to notify users when their housing add is about to expire. These notifications are sent 30 and 15 days prior expiration. My problem is that notifications are sent in many copies.
This Monday, one notification was sent twice at 18:33 and then twice again at 21:54. All to the same email.
2 things :
- Posts are bilingual, so maybe that explains the "twice"thing. But still it was sent at 2 different time in the same day.
- Post also have an expiration date, auto-enabled when the user first submits the form.
That listing will automatically have an expiration date/time (which is stored as a hidden custom field, with post meta key of _cred_post_expiration_time).
The form adds notifications to be sent 30 days and 15 days prior to that expiration time (details of the notifications are also stored in a hidden custom field, with post meta key of _cred_post_expiration_notifications).
Q: At some point after the post is submitted and published it gets translated to the second language?
Q: Is the above form only available in one language, or the form has been translated and users can submit adverts in either language (and they then get translated to the other language)?
It would be helpful to check the database to see what entries there are for those hidden custom fields for the adverts in the original language as well as for their translations. (Unless you explicitly set those hidden custom fields as translatable then I would not expect the translated advert to have entries for them, in which case getting 4 notifications—spread over a few hours—for a single advert would be difficult to explain.)
If that's okay let me mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site.
Can you also confirm which is the advert that sent these erroneous notifications as well as its history, thanks.
From your screenshots the notifications are all to the same email address, but they don't show which posts they refer to.
The email address comes from a field in the form ("courriel"), so I added a plugin where I could query the database directly and I searched wp_postmeta for meta values with that email address.
And it returned 40 results.
So there are 40 logement posts from the same user. Is it not possible that the email notifications that were sent out (4 to that user) were correct, i.e that they did have 2 then another 2 logement posts that would expire in 30 days?
Have you seen the same problem with other notifications for users that don't have so many logement posts?
We have another file that is on the listing right now : hidden link
The system sent 4 notifications too. (yesterday). And I'm pretty sure they don't have such many add than the other email-user.
- 2 at 6:11
- 2 at 18:13
But the third add (hidden link), received only once at 01:17 this morning
Also, the notifications are supposed to show the post link, but it doesn't
I first add the [wpv-post-url] shortcode in the email text, but the link woulnd't show. So I changed for %%POST_LINK%%, but still, nothing. Now I wrote both ([wpv-post-url] %%POST_LINK%%), to see if anything will appears next time.
When I check the hidden fields in the database which are responsible for the notifications I see multiple entries for the latest problem post you shared, when the entries should be unique.
So I'm not surprised there are multiple notifications being sent that shouldn't be, but I can't explain why there are multiple entries in the database in the first place.
Do you have a staging server available for testing? I'd like to go through the process of using the forms to add and to edit the posts, and do so in a minimal environment (e.g. with the non-essential plugins all deactivated) so I can track what happens.
(I'll set another private reply in case you have some credentials to share for such a test server.)
I've been testing on the staging server and submitting and editing logement posts from the front end, and I've been checking the database to double-check the data stored about the notifications as I go.
I've tried with various combinations of plugins active or inactive, and I haven't been able to reproduce what I see on your production site, where there are multiple entries in wp_postmeta for details about the notifications where I would expect to see only single entries.
So I'm not any closer to understanding what is triggering that.
Would it be possible to install an activity logging plugin on your site to be able to see all the actions taken on the site, which may help identify what causes the unexpected multiple entries in the database.
And, would it be possible to quickly publish a test post on the production site (which I would delete after a couple of minutes once I'd checked the entries in the database for it)?
Just to note, I see that there are only a few published such posts (quite a few test posts in the trash, which I have emptied).
So I went in to wp_postmeta and manually fixed the duplicate entries relating to notifications for these few posts, so at the moment everything should be okay for the existing posts.
Let's keep an eye on if it breaks going forward, and use the activity log to try and isolate why.
I also re-checked the existing posts, and there is no change there, they all have the expected entries in the database, so at the moment I wouldn't expect you to get any erroneous notifications.
Do you have a sample / picture of what a multiple-entry database looks like? I may be able to update the database myself if I see any further troubles with the notifications