Skip Navigation

[Closed] Interminent Post Form Duplicate Posts

This support ticket is created 3 years, 10 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
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 10 replies, has 2 voices.

Last updated by Jamal 3 years, 10 months ago.

Assisted by: Jamal.

Author
Posts
#1949179
duplicate_records_0.png
duplicate_records_1.png
interminent.png

Hi,
In our production site, futuregolf.com.au, we have a post form which requests information from a user. See attached example from our non-production environment. (image; interminent.png).
As you can see in the screenshot, when a user clicks submit, the spinner is displayed until the post form is complete.

We're seeing instances though as you can see from images (duplicate_records_1.png & duplicate_records_0.png) that in the database, the records are being submitted twice and the post form emails are also being sent twice.
You'll notice that timestamps are within the same minute & within a couple seconds of each other.

To me, this looks like a PHP or Toolset issue. Are you able to advise what could be done about this? Is it worth putting in validation for this in PHP to check for duplicates or would this not catch it? (I assume not as it seems to be as per the same request).

Happy to provide access to non production environment but as mentioned above, this is interminent.

PS: The post form is set to "add new content" and the form submit is ticked (i.e. submit this form without reloading the page)

Cheers

#1949749

Hello and thank you for contacting the Toolset support.

I don't believe that implementing validation would be a good idea. I can only imagine what outcome would the user see.

A similar error was reported a couple of years ago and was triggered by the Relevanssi plugin and AJAX upload of images https://toolset.com/errata/cred-auto-draft-posts-created-when-relevannsi-cred-and-featured-images-are-used/

Because this is intermittent, I would like to ask how many times did this happen? Can you imagine and verify if a set of conditions trigger this?
If it only happens one time, or once in a long time, I would suspect a glitch on the server at that moment.
But, if it happens few times per week or per day, we definitely need to understand what happens and find a fix.

#1950527
toolset_doublesubmission.png

Hi,

Thanks for the link. I'm on version 2.6.5 of Toolset Forms so I am assuming I don't need to apply the patch as mentioned here: https://toolset.com/errata/cred-auto-draft-posts-created-when-relevannsi-cred-and-featured-images-are-used/ ?

I DO have the Relevanssi plugin activated so could be related.

To answer your question re: frequency. We on average have roughly 1,456 unique posts a month. See attached graph of number of number of posts that were submitted more than once.
So for the month of Jan 2021, we had a total of 5,283 posts with 426 of these being duplicates or more.

Thoughts on what we can do to troubleshoot and isolate?

Cheers

#1951541

426 cases on a month are definitely something, and it needs to be addressed.

I must confess, I don't see what to try next. And you are right, the fix on the errata that I previously shared is not relevant anymore.
A workaround would be to disable AJAX on that form, but I believe that's not what you would want, right?

I am sure you will understand that we can't really debug and fix an error if we are not able to reproduce it. But, any additional information can help us figure this out.
- Does the form offer to upload an image or multiple images, or maybe other types of files?
- Can you see any pattern on these duplicates? Time of submission, data, etc.

I might suspect that quick clicks on the Submit buttons perform multiple requests and then creates duplicates, but I think that this was handled before, and I would like to access the staging site and test myself. Your next reply will be private to let you share credentials safely.
Please share the URLs where we can see the form.

#1958271

Thank you for sharing this staging site and for the clear steps to follow to submit the form.

I run a test and it did not create a duplicate post, it only created one post. So, I wanted to try again, but I get stuck at the "nominated social rounds" step because it does not hold a value after my first form submission. hidden link

I wanted to follow the "get-ga-handicap-status" shortcode to understand how I can unlock myself and continue testing, but I did not find the shortcode definition in Toolset->Settings->Custom Code snippets or in the theme's functions.php file.

Can you explain how to make this field populated so I can continue my tests?

#1962361

Hi Jamal,

On the URL hidden link, you will see a button called "Nominate", please select todays date and select any values from the dropdown. Once you have done this, the selected value from this form will appear in the "Submit Scorecard" button/form.

Cheers

#1962745

Hello there!

I tried 3 times with different inputs, changing the date, trying without the image, but I could not reproduce the issue.

I'll try again later and hopefully, I can find something.

#1963593

Thanks, you'll see that once you submit the record - the record to select goes away so you can therefore see that having duplicates shouldn't be possible but it is as per the screenshot I sent through earlier.

#1963821

I run a couple of tests again and I was not able to reproduce the issue. Maybe it just happens on your production site. Or maybe it happens because of server setup. I can't really imagine the cause.

What I would suggest is to use some custom code to identify the duplicated posts and notify the administrator about them.

I don't think using cred_form_validate is a good idea. Because you may deny the creation of the duplicate post successfully, but the user will get the error message and will think that his submission did not complete.

Instead, you can use the cred_submit_complete hook, look for the duplicate post(same user, same attached image, created in less than 1min, etc.), change its status to "Draft" and notify the administrator about it.

If, in the future, you see a pattern of these duplicates and you guess the steps that trigger it, please get back to us and we'll do our best to help.

#1966857
dupply.png

Jamal, are you able to tell me or confirm how you created these two records?
I think this is actually the issue.
Technically speaking according to my code, you should not be able to have two records for the same "wpcf-related-social-round-nomination-id" so I think you may have actually re-created the issue.
I know you were able to upload a different image to the second record (641668) which is interesting....

#1967769

I was working on two separate tabs. I wanted to create multiple nominations and try to add scores for them. I also noticed that the same nomination appeared for both of the tabs, but I did not give it too much attention.
Each entry was created on a separate browser tab.

The topic ‘[Closed] Interminent Post Form Duplicate Posts’ is closed to new replies.