From c4da5360d48c9de5ed9906e07e8c3c45961fc8c6 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sun, 14 Feb 2010 10:59:37 +0000 Subject: [PATCH] Adjust regex for counting links in a comment when checking if it needs to be held for moderation. Also fix notice in wp_new_comment(). see #11830 git-svn-id: https://develop.svn.wordpress.org/trunk@13150 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/comment.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 1bd7d6fc18..5529702034 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -45,7 +45,7 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $ if ( 1 == get_option('comment_moderation') ) return false; // If moderation is set to manual - if ( get_option('comment_max_links') && preg_match_all("/<[Aa][^>]*[Hh][Rr][Ee][Ff]=['\"]([^\"'>]+)[^>]*>/", apply_filters('comment_text',$comment), $out) >= get_option('comment_max_links') ) + if ( get_option( 'comment_max_links' ) && preg_match_all( '/]*href/i', apply_filters( 'comment_text', $comment ), $out) >= get_option( 'comment_max_links' ) ) return false; // Check # of external links $mod_keys = trim(get_option('moderation_keys')); @@ -1267,7 +1267,7 @@ function wp_new_comment( $commentdata ) { $post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment - if ( get_option('comments_notify') && $commentdata['comment_approved'] && $post->post_author != $commentdata['user_id'] ) + if ( isset( $commentdata['user_id'] ) && get_option('comments_notify') && $commentdata['comment_approved'] && $post->post_author != $commentdata['user_id'] ) wp_notify_postauthor($comment_ID, $commentdata['comment_type']); }