Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#8343 closed defect (bug) (fixed)

Comment Form Submission: need action hook

Reported by: tonebari Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version:
Component: Comments Keywords: has-patch commit
Focuses: Cc:


I wrote a little AJAX plugin to challenge-response the browser on comment form load. It provides CAPTCHA if no JavaScript. Problem is I had to hack wp-comments-post to use wp_die() if validation doesn't happen. It would be awesome to have an action hook right after nocache_headers().

Attachments (1)

8343.diff (442 bytes) - added by Denis-de-Bernardy 7 years ago.

Download all attachments as: .zip

Change History (6)

#1 @janeforshort
7 years ago

  • Milestone changed from 2.8 to Future Release

Punting due to feature freeze. Reconsider with next release.

#2 @Denis-de-Bernardy
7 years ago

  • Milestone changed from Future Release to 2.8

itching to close as invalid. wp-load.php ends with the init hook. you can use it to conditionally call nocache_headers() and die if your check is failed.

attaching a patch nonetheless.

please close as invalid/wontfix if this doesn't make it into 2.8.

#3 @Denis-de-Bernardy
7 years ago

  • Component changed from General to Comments
  • Keywords has-patch commit added
  • Owner anonymous deleted

#4 @westi
7 years ago

You can already use the pre_process_comment hook in wp_new_comment to achieve what you want.

However, I can see the benefit of another hook here for earlier work.

I am going to add an action to the if/then/else that appears just after so it only fires if WordPress would have accepted the comment anyway.

New action is called 'pre_comment_on_post'

#5 @westi
7 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [11248]) Add 'pre_comment_on_post' action to allow early denial by spam plugin. Fixes #8343.

Note: See TracTickets for help on using tickets.