Add comment_duplicate_trigger hook that is fired when a duplicate comment is detected. Fixes #12188

git-svn-id: http://svn.automattic.com/wordpress/trunk@13434 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-02-26 19:06:09 +00:00
parent c277384459
commit da2634030a
1 changed files with 2 additions and 0 deletions

View File

@ -531,6 +531,7 @@ function sanitize_comment_cookies() {
* @since 2.0.0
* @uses $wpdb
* @uses apply_filters() Calls 'pre_comment_approved' hook on the type of comment
* @uses apply_filters() Calls 'comment_duplicate_trigger' hook on commentdata.
* @uses do_action() Calls 'check_comment_flood' hook on $comment_author_IP, $comment_author_email, and $comment_date_gmt
*
* @param array $commentdata Contains information on the comment
@ -547,6 +548,7 @@ function wp_allow_comment($commentdata) {
$dupe .= "OR comment_author_email = '$comment_author_email' ";
$dupe .= ") AND comment_content = '$comment_content' LIMIT 1";
if ( $wpdb->get_var($dupe) ) {
do_action( 'comment_duplicate_trigger', $commentdata );
if ( defined('DOING_AJAX') )
die( __('Duplicate comment detected; it looks as though you’ve already said that!') );