Please see https://toolset.com/forums/topic/cred-form-emails-with-expiry-dates/#post-1104397
Basically, I've done some testing on my staging2 site. The email to the supplier 'Your listing for %%POST_TITLE%% is expiring SOON. Please renew' which uses 'Send notification to an email specified in a form field:' didn't send at all. It was ONLY those that have both an expiry date and 'Send notification to an email specified in a form field' set that had an issue. This was resolved by you in Toolset Form plugin, version 2.1, but now I'm finding two emails are sent.
The only thing I can think of is that originally I'd set the 'Notification e-mail trigger' in the email at 8 days and adjusted to 30 minutes for testing.
Hi, I don't see login credentials for staging in either ticket. Can you add those here so I can take a look?
Can you help me understand which Form and which notification, specifically, you are discussing? I see several notifications that use similar terminology about expiring listings, but it's not clear to me which one(s) you are referring to. Then please let me know how to access the Form on the front-end of the site so I can get some context. Thanks!
OK, I've changed the URL below - you'll need to change mywebsite to known domain...
hidden link
Email to Supplier - Expiry date - 1st Renewal free account
And front end you'll need to login as (please remove login credentials)
You'll be redirected to the root URL. Ensure you are back on /staging2/
hidden link
This was resolved by you in Toolset Form plugin, version 2.1, but now I'm finding two emails are sent.
In the previous ticket (https://toolset.com/forums/topic/cred-form-emails-with-expiry-dates/#post-1103227) you mentioned that you had updated and you were just about to test. That was on September 08.
The duplicate emails in staging2 "1st FREE Your listing for TEST for ONE Email is expiring SOON. Please renew." were sent on Sept 5. Since the 8th, I do not see any duplicate emails in the logs. At least 3 emails with a similar subject line are noted (see the screenshot).
- Can you tell from the subjects if these notifications were sent by the same Form and notification?
- Would you expect to see duplicates for these 3 notifications as well, based on what you know about the previous duplicates?
- Are you seeing duplicate emails on the live site since updating?
I don't see a screenshot - sorry? If you look at the form though you'll see all emails (excluding admin emails to simplify).
Email to Supplier - business now live
Email to Supplier - payment details (Gold and Plat)
Email to Supplier - Expiry date - 1st Renewal free account (my testing email)
I think it's only those emails that have both an expiry date and 'Send notification to an email specified in a form field' set (as in my original support ticket).
I attach a screen shot of the duplicate of my test email. It's definitely the same one because I altered the Subject Line to ensure unique.
The other emails are to do with 'live' listings that have coincidentally come round to their expiry date (circa 22nd Sept) they are a year old. As I mentioned before I was waiting until they have actually expired to see if further emails are sent. Please ignore for now - though I will continue to monitor.
I have had trouble with emails for over two years, notably when using expiry dates and have disabled most emails in the live site until email notifications are a bit more stable.
What I'm wondering is if the Expiry date is altered, it 'remembers' both dates and sends. On my test site only I had originally set the 'Notification e-mail trigger' in the email at 8 days and adjusted to 30 minutes for testing.
Here's the screenshot, sorry. I'm seeing 3 emails since the 5th that look like the same notification with no duplication:
"1st FREE Your listing for {post title} is expiring SOON. Please renew."
What I'm wondering is if the Expiry date is altered, it 'remembers' both dates and sends. On my test site only I had originally set the 'Notification e-mail trigger' in the email at 8 days and adjusted to 30 minutes for testing.
Okay, can you check the postmeta table for the post associated with this email notification? I would like to know:
- how many "_cred_post_expiration_action" rows you see for this post
- how many "_cred_post_expiration_time" rows you see for this post
- The contents of any "_cred_post_expiration_action" rows you see for this post. These will be serialized, so be careful not to make changes just copy + paste for me to review.
Re the screen shot, I've explained this anyway now. Will monitor.
I'm not entirely sure what the post ID is as I deleted it as I assumed when you asked how to log in as a user you'd be adding your own. I think it's probably 3960 - see screen dump - i.e the one before The Woodland Farm.
I don't see any of these rows you mentioned though - anywhere in the latest records - including my test and the others in your screen dump?
- how many "_cred_post_expiration_action" rows you see for this post
- how many "_cred_post_expiration_time" rows you see for this post
- The contents of any "_cred_post_expiration_action" rows you see for this post. These will be serialized, so be careful not to make changes just copy + paste for me to review.
I searched for _cred_post_expiration_action see screen dump.
I don't see any of these rows you mentioned though - anywhere in the latest records - including my test and the others in your screen dump?
Okay yes this makes sense if the post was deleted after expiration. The rows I mentioned will be deleted automatically. I tried to replicate the problem by creating a new Supplier post with the automatic expiration date set to be 30 days from publish. Then I edited the same Supplier post in wp-admin, and published the post with set the expiration date to be in about 1 hour. The email notification was set to 1 minute before expiration. I don't see any duplicated emails in the mail logs, so unless I've misunderstood the process of how it was triggered, I believe the most recent update resolved the duplicate email problem. I have disabled all the other email notifications for now on staging2.
I've set up another test...
Firstly I re-enabled the 'Email to Supplier - Expiry date - 1st Renewal free account' as this is the one I'm having trouble with. i.e. it's ONLY those that have both an expiry date and 'Send notification to an email specified in a form field' set that had an issue.
I logged on as a Supplier - credentials above staging2/?page_id=176. I added a new supplier listing.
I logged on as an Admin and Published the Post above.
I set the Post will expire to 30 minutes (as 30 days is too long to wait to see it expire). And set the email notification to 10 minutes before expiry.
I will monitor and get back to you re emails sent.
I'm doing one final test to confirm an issue still - but please see image attached.
Re my new test.
_cred_post_expiration_notifications (NOTE: Email to Supplier - Expiry date - 1st RENEWAL is disabled).
I can see only one each of "_cred_post_expiration_action" and "_cred_post_expiration_time" for this post - see attached.
PS. I've edited to obscure sensitive information, but you might want to make private.
Last two tests (since I've changed everything back to re-test #1109448) I now appear to be sending three emails!
See attached.
And what's even worse is subject line '1st GoldPlat with Banking Your listing for %%POST_TITLE%% is expiring SOON. Please renew.' (Email to Supplier - Expiry date - 1st RENEWAL — Disabled) is disabled. I've only two emails enabled:
EXPIRING Listing for %%POST_TITLE%% on %%EXPIRATION_DATE%% (Email to Admin - Expiry Date - 1st RENEWAL)
1st FREE Your listing for %%POST_TITLE%% is expiring SOON. Please renew. (Email to Supplier - Expiry date - 1st Renewal free account) - the one that's duplicating.
Replacing text in a serialized data string with strings of different lengths breaks the serialization structure, making it impossible to de-serialize. So I'm not able to see clearly what's going on. Can you provide a database dump SQL file? Or re-obfuscate the original serialized string with strings of identical lengths? I'll delete the serialized data you posted.
I've been trying to replicate this on my local environment for hours now and I haven't been able to reproduce the duplicate email issue. The partial database dump shows duplicate entries for keys __cred_notification_data, _cred_post_expiration_time, and _cred_post_expiration_action for post_id #2550, as well as several other keys, but no explanation for those duplicates. At this point, I need to hand this off to my 2nd tier support team for additional investigation. To do that, I need a full site clone or a backup of the database, themes and plugins folders. I will activate a private reply fields here so you provide a download link for either of those options.