From 90e6959288359d831f59c6bdc6848a314fe703f1 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 22 Mar 2005 00:29:43 +0000 Subject: [PATCH] Validate comment author email. http://mosquito.wordpress.org/view.php?id=982 Props: MtDewVirus git-svn-id: https://develop.svn.wordpress.org/trunk@2464 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-comments-post.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-comments-post.php b/wp-comments-post.php index 6833c2c572..63753286d5 100644 --- a/wp-comments-post.php +++ b/wp-comments-post.php @@ -31,8 +31,12 @@ endif; $comment_type = ''; -if ( (get_settings('require_name_email') && !$user_ID) && ('' == $comment_author_email || '' == $comment_author) ) - die( __('Error: please fill the required fields (name, email).') ); +if ( get_settings('require_name_email') && !$user_ID ) { + if ('' == $comment_author_email || '' == $comment_author) + die( __('Error: please fill the required fields (name, email).') ); + elseif ( !is_email($comment_author_email)) + die( __('Error: please enter a valid email address.') ); +} if ( '' == $comment_content ) die( __('Error: please type a comment.') );