Make WordPress Core

Opened 16 years ago

Closed 9 years ago

#9775 closed enhancement (fixed)

Duplicate comment check is too strict

Reported by: scribu's profile scribu Owned by: boonebgorges's profile boonebgorges
Milestone: 4.4 Priority: normal
Severity: normal Version: 2.7.1
Component: Comments Keywords: needs-patch
Focuses: Cc:

Description

The duplicate comment detection mechanism doesn't allow duplicate comments on the same post, even from the post author. That's not good.

The duplicate comment check should only block the new comment if there is no other comment posted between the new comment and the old comment.

Change History (18)

#1 @scribu
16 years ago

  • Summary changed from Duplicate comment not allowed on same post to Improve duplicate comment detection

#2 @scribu
16 years ago

  • Summary changed from Improve duplicate comment detection to Duplicate comment check is too strict

#3 follow-up: @Denis-de-Bernardy
16 years ago

It would depend on the purpose.

As I understand things, its main purpose is to make sure that double clicking the publish comment button won't output two comments. Adding a unique ID for each comment, that gets passed into the comment form, and that expires upon the comment being saved, would easily defeat this (it would probably cut a lot of spam, too). The duplicate-comment check could then be rendered obsolete, in favor of redirecting to the newly published comment itself.

#4 @Denis-de-Bernardy
16 years ago

  • Milestone changed from 2.8 to Future Release

punting to future, pending patch

#5 in reply to: ↑ 3 @scribu
16 years ago

Replying to Denis-de-Bernardy:

As I understand things, its main purpose is to make sure that double clicking the publish comment button won't output two comments.

Yes, I think that's it's main purpose too.

Adding a unique ID for each comment, that gets passed into the comment form, and that expires upon the comment being saved, would easily defeat this (it would probably cut a lot of spam, too). The duplicate-comment check could then be rendered obsolete, in favor of redirecting to the newly published comment itself.

The unique ID could use a mechanism similar to post-new.php that assigns a neggative ID to a post, before it is saved.

Also, this plugin implements a similar technique: http://wordpresssupplies.com/wordpress-plugins/captcha-free/

#6 follow-up: @Denis-de-Bernardy
16 years ago

it might interfere with caching plugins however.

#7 in reply to: ↑ 6 @scribu
16 years ago

Replying to Denis-de-Bernardy:

it might interfere with caching plugins however.

Not if you add it dynamically through JS. But then users with JavaScript disabled can't comment.

Therefore, I still think it's a more robust ideea to check for intermediate comments before blocking.

#8 @Denis-de-Bernardy
16 years ago

  • Type changed from defect (bug) to enhancement

#9 @caesarsgrunt
15 years ago

Why would you ever want to post two identical comments, even if there were other comments between them?

#10 @josephscott
15 years ago

I think this should be closed as invalid. Providing a way to get around the duplicate comment check is asking for problems.

#11 @skithund
15 years ago

  • Cc skithund added

How about making the duplicate check pluggable, so people (like me) could get around it with a plugin if necessary?

#12 @skithund
15 years ago

  • Keywords needs-patch removed
  • Milestone changed from Future Release to 3.0
  • Resolution set to fixed
  • Status changed from new to closed
  • Version changed from 2.7.1 to 3.0

This has been fixed by making duplicate comment check pluggable.

From #12188:
(In [13434]) Add comment_duplicate_trigger hook that is fired when a duplicate comment is detected. Fixes #12188

#13 @scribu
12 years ago

  • Milestone changed from 3.0 to Awaiting Review
  • Resolution fixed deleted
  • Status changed from closed to reopened

You can use 'comment_duplicate_trigger' only to customize the message that the user sees, after it has been decided that the comment is a dup.

Related: #21609

#14 @SergeyBiryukov
12 years ago

  • Version changed from 3.0 to 2.7.1

#15 @SergeyBiryukov
11 years ago

#27138 was marked as a duplicate.

#16 @rachelbaker
9 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

This needs a patch if we are going to add a filter here.

#17 @boonebgorges
9 years ago

  • Milestone changed from Future Release to 4.4

I agree that the duplicate check is probably stricter than it really needs to be. It's perfectly legitimate for, say, a post author to reply to multiple comments on a thread by saying "Yes" or "Thanks" or whatever.

That said, I don't know how to allow that without also allowing the double-click problem that the duplicate check was originally intended to prevent. Let's put in a filter and let people adjust as they see fit.

#18 @boonebgorges
9 years ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from reopened to closed

In 34536:

Introduce 'duplicate_comment_id' filter.

wp_allow_comment() disallows a comment if it matches a comment on the same
post with the same content, author email, and parent. This new filter allows
developers to circumvent or modify this logic, making the duplicate check
more or less lenient, as they see fit.

Fixes #9775.

Note: See TracTickets for help on using tickets.