mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
wp_die() for comment errors. Props filosofo. fixes #1786
git-svn-id: http://svn.automattic.com/wordpress/trunk@3984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f02a7931d8
commit
550ede8d60
@ -12,7 +12,7 @@ if ( empty($status->comment_status) ) {
|
|||||||
exit;
|
exit;
|
||||||
} elseif ( 'closed' == $status->comment_status ) {
|
} elseif ( 'closed' == $status->comment_status ) {
|
||||||
do_action('comment_closed', $comment_post_ID);
|
do_action('comment_closed', $comment_post_ID);
|
||||||
die( __('Sorry, comments are closed for this item.') );
|
wp_die( __('Sorry, comments are closed for this item.') );
|
||||||
} elseif ( 'draft' == $status->post_status ) {
|
} elseif ( 'draft' == $status->post_status ) {
|
||||||
do_action('comment_on_draft', $comment_post_ID);
|
do_action('comment_on_draft', $comment_post_ID);
|
||||||
exit;
|
exit;
|
||||||
@ -31,20 +31,20 @@ if ( $user->ID ) :
|
|||||||
$comment_author_url = $wpdb->escape($user->user_url);
|
$comment_author_url = $wpdb->escape($user->user_url);
|
||||||
else :
|
else :
|
||||||
if ( get_option('comment_registration') )
|
if ( get_option('comment_registration') )
|
||||||
die( __('Sorry, you must be logged in to post a comment.') );
|
wp_die( __('Sorry, you must be logged in to post a comment.') );
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
$comment_type = '';
|
$comment_type = '';
|
||||||
|
|
||||||
if ( get_settings('require_name_email') && !$user->ID ) {
|
if ( get_settings('require_name_email') && !$user->ID ) {
|
||||||
if ( 6 > strlen($comment_author_email) || '' == $comment_author )
|
if ( 6 > strlen($comment_author_email) || '' == $comment_author )
|
||||||
die( __('Error: please fill the required fields (name, email).') );
|
wp_die( __('Error: please fill the required fields (name, email).') );
|
||||||
elseif ( !is_email($comment_author_email))
|
elseif ( !is_email($comment_author_email))
|
||||||
die( __('Error: please enter a valid email address.') );
|
wp_die( __('Error: please enter a valid email address.') );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( '' == $comment_content )
|
if ( '' == $comment_content )
|
||||||
die( __('Error: please type a comment.') );
|
wp_die( __('Error: please type a comment.') );
|
||||||
|
|
||||||
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'user_ID');
|
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'user_ID');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user