Preventing double posts - maybe via jQuery?

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
Post Reply
digitaltoast
Registered User
Posts: 103
Joined: Thu Oct 18, 2007 9:33 am

Preventing double posts - maybe via jQuery?

Post by digitaltoast » Sun Apr 29, 2018 5:48 pm

For some reason, a few users are reporting that they are getting double posts/replies.

I've been able to replicate at least the posting part, by double clicking "submit" on a new post. I'm surprised "prevent 5 posts being made in the same 2 seconds" isn't baked in to phpbb, but nonetheless, this should be quite a simple question of applying a "prevent click" type of method in jquery to the buttons once clicked, should it not?

How have others overcome this? I saw a couple of mods/extensions for this, but they were years old.

User avatar
david63
Registered User
Posts: 16189
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Preventing double posts - maybe via jQuery?

Post by david63 » Sun Apr 29, 2018 6:02 pm

ACP > Post settings > Flood interval
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

digitaltoast
Registered User
Posts: 103
Joined: Thu Oct 18, 2007 9:33 am

Re: Preventing double posts - maybe via jQuery?

Post by digitaltoast » Sun Apr 29, 2018 6:21 pm

Thank you - wasn't aware of that, however, I looked and it's already set to 15 seconds. Hmmmm... :?

User avatar
jan_2017
Registered User
Posts: 148
Joined: Sun May 07, 2017 3:39 pm

Re: Preventing double posts - maybe via jQuery?

Post by jan_2017 » Sun Apr 29, 2018 8:35 pm

I do not want to advertise, but I use the extension "post merging".
Try it.

User avatar
david63
Registered User
Posts: 16189
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Preventing double posts - maybe via jQuery?

Post by david63 » Sun Apr 29, 2018 8:35 pm

digitaltoast wrote:
Sun Apr 29, 2018 6:21 pm
Thank you - wasn't aware of that, however, I looked and it's already set to 15 seconds. Hmmmm... :?
Then increase it to, say, 30 seconds and see if that solves the problem
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

digitaltoast
Registered User
Posts: 103
Joined: Thu Oct 18, 2007 9:33 am

Re: Preventing double posts - maybe via jQuery?

Post by digitaltoast » Mon Apr 30, 2018 7:28 am

Oh, you mean in case the flag had got corrupted in the DB? Tried it, but still getting two posts.

I mean, we're talking about a flag set for 15 (now 30) seconds, and a double-click speed of between 80 and 100ms.

My server seems to respond to a posting within 300ms, therefore, I wonder if there's some kind of queue/race condition whereby it is not able to check the DB for previous posts as fast as the second post arrives? Which is why I think something "front end" might be better.

Or, as a last resort, possibly there might be something in nginx to prevent rapid fire "post" submissions. But it would be good to fix this natively if at all possible :)

User avatar
Mick
Support Team Member
Support Team Member
Posts: 21153
Joined: Fri Aug 29, 2008 9:49 am
Location: Watching cricket - definitely

Re: Preventing double posts - maybe via jQuery?

Post by Mick » Mon Apr 30, 2018 7:40 am

Sometimes I get that here and other boards and it always seems to be down to server lag, you click submit, it doesn’t appear to go straight away you click again and you end up with double posts.
"The more connected we get the more alone we become" - Kyle Broflovski

digitaltoast
Registered User
Posts: 103
Joined: Thu Oct 18, 2007 9:33 am

Re: Preventing double posts - maybe via jQuery?

Post by digitaltoast » Mon Apr 30, 2018 7:44 am

I think a server response of 300ms for a post is reasonable - but more to the point, if "flood control" is set to 15 seconds, should that prevent a second post within 100ms?

User avatar
Mick
Support Team Member
Support Team Member
Posts: 21153
Joined: Fri Aug 29, 2008 9:49 am
Location: Watching cricket - definitely

Re: Preventing double posts - maybe via jQuery?

Post by Mick » Mon Apr 30, 2018 7:48 am

I suppose it depends if phpBB has registered that the first post has actually gone at the time submit is clicked a second time.
"The more connected we get the more alone we become" - Kyle Broflovski

digitaltoast
Registered User
Posts: 103
Joined: Thu Oct 18, 2007 9:33 am

Re: Preventing double posts - maybe via jQuery?

Post by digitaltoast » Mon Apr 30, 2018 7:52 am

Exactly - and I don't think it is. Looks like flood control can't be relied on then; I'll look into jQuery or nginx tweaking and post back here when I've found something that works. Thanks.

Post Reply

Return to “[3.2.x] Support Forum”