Home › Toolset Professional Support › [Closed] Bug with email notifications (multiple copies sent)
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 25 replies, has 2 voices.
Last updated by Nigel 1 year, 1 month ago.
Assisted by: Nigel.
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
OK, I was checking the data from the posts ordinarily shown in the back end (i.e. the French ones) and not the English versions of the posts.
I found that the post with ID 71524 has the duplicate entries in wp_postmeta that I suspect may be causing the multiple notifications. (I've added a mail catcher plugin to your site to see details of the sent emails as at the moment I can't see them.)
Can you confirm what the workflow is for publishing the logement posts, specifically as it relates to creating the duplicates in the other language? So when a post is submitted in French, what's the process for creating the English duplicate? (That may be where the problem arises.)
The duplicates are created when the forms are submitted by a custom code in Toolset / Parameter / Custom Code
It works the same way for housing / locations and some CPT for one-to-many relationships (didn't want to have to translate them manually everytime I created one).
Auto-duplicate - New form submission (Lieux - logements - Org - CPT)
<?php
/**
* New custom code snippet (replace this with snippet description).
*/
toolset_snippet_security_check() or die( 'Direct access is not allowed' );
// Put the code of your snippet below this comment.
// Automatically generate translation duplicates on posts created with a Toolset Form
function quick_duplicate_save_data_action($post_id, $form_data)
{
// Edit form ID(s)
$forms = array(8706,20129,19965,74050,74061,74064,74063);
if (in_array($form_data['id'], $forms)) {
global $sitepress;
// make translated duplicates
do_action('wpml_make_post_duplicates', $post_id);
}
}
add_action('cred_save_data', 'quick_duplicate_save_data_action', 10, 2);
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
OK, I did some testing on my own local site where I used similar code to duplicate the posts created by the form to see if they also had the problem with multiple entries in wp_postmeta for the notification-related fields, but I didn't experience the same.
But it does look like the most likely source of the problem.
I'm wondering why you are creating duplicate posts, though, given that they are just the same as the original language versions (they don't have translated text).
Maybe it's because this is an old site, and in the old days of WPML, if you wanted visitors trying to see a post in a language it wasn't translated to you had to create a duplicate post of the source language to show.
But that changed quite a long time ago (not sure when), with the addition of the fallback translation setting, which means "if there is a translation available, show it, otherwise just show the original language post", and I suspect that would suit your needs.
So you could avoid creating all the duplicate posts, and that may eliminate the problem we've seen.
Do you want to try that, or is there a reason you need to create the duplicates?
Good morning Nigel,
At the beginnings or WPML we add to create the translated version manually and we had 3 choices : duplicate original language, copy original data, translate
I fisrt allowed the posts to have different language text, and I was manually translating what the post owner had written. But then, I decided that no matter the original language chosen (FR or EN), the translation would show the same text.
But again, I didn't want to manually create the duplicate translation, so I added the code.
So now, when a form is submitted, there is automatically an EN version created. The content is the same, but the template display is in EN, as I've translated all strings.
I always thought that I needed an translation version of a post in order for it to show in the translated website. I am wrong?
If not, I just create a FR post and the english sites show the FR content? I'm not sure I understand what you're saying 🙂 🙂
Catherine 🙂
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
If you set the translation preference for your custom post type to translate with fallback (the option in my previous screenshot) then there is no need to create duplicates.
A post is published in French.
Visit it on the front end. Use the language switcher to switch to English and the French post will be shown, even though the URL is the English URL.
(That's the same as happens now, but you have duplicated the French post to English. It is no longer necessary to do that. The fallback option acts as if there were an English duplicate without having to make one.)
Hi Nigel,
Thanks for keeping this thread opened.
I tried to enable the failback and deleted the EN translations. Now all the posts apperas in both FR and EN. Can you validate if the post data are good or they still show the many entries?
Also, one alert was sent to a draft post. I understand the alerts are linked to the expiration date more than the post status? (see image attached)
I went back to notifications settings, and I don't see anything that could let me add another conditionnal to the trigger (send when 15 days to expiration AND post is published)
Happy Monday!
Catherine 🙂
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Sorry Catherine, can you remind me, I should now be looking on the live server or the staging server to check?
You can do both! haha 😀
Live site is OK, I have a backup of today's database 🙂
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
OK, so I checked the live site and everything seems to be in order when it comes to the post meta entries, no duplicates found.
Although you have updated the translation preference for the logement accessible post type to translate with fallback, there are still duplicates of some of the existing posts to English.
So a French and and English version of the same post, each of which set to send a notification.
There isn't a way to expand the condition for sending the notification to not send notifications for draft posts.
OK..
I've decided to start from fresh, so I've deleted all draft posts (they were old so it's ok)
Right now, I only have 5 FR published posts. Do you still have some duplicates / data issues?
Dully noted for the draft / publish status for notification.
I'll try to manage that manually
Catherine 🙂
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Those remaining published FR posts are the ones I checked the post meta for already to confirm they are okay, and there are no longer English duplicates of the posts, so I very much expect that you will only get a single notification each time when the notifications are due.
Let's see!
The topic ‘[Closed] Bug with email notifications (multiple copies sent)’ is closed to new replies.