Make WordPress Core

Ticket #1786: wp-comments-post.php.2.diff

File wp-comments-post.php.2.diff, 1.5 KB (added by filosofo, 20 years ago)

A better version of the same idea, using wp_die

  • wp-comments-post.php

     
    1212        exit;
    1313} elseif ( 'closed' ==  $status->comment_status ) {
    1414        do_action('comment_closed', $comment_post_ID);
    15         die( __('Sorry, comments are closed for this item.') );
     15        wp_die( __('Sorry, comments are closed for this item.') );
    1616} elseif ( 'draft' == $status->post_status ) {
    1717        do_action('comment_on_draft', $comment_post_ID);
    1818        exit;
     
    3131        $comment_author_url   = $wpdb->escape($user->user_url);
    3232else :
    3333        if ( get_option('comment_registration') )
    34                 die( __('Sorry, you must be logged in to post a comment.') );
     34                wp_die( __('Sorry, you must be logged in to post a comment.') );
    3535endif;
    3636
    3737$comment_type = '';
    3838
    3939if ( get_settings('require_name_email') && !$user->ID ) {
    4040        if ( 6 > strlen($comment_author_email) || '' == $comment_author )
    41                 die( __('Error: please fill the required fields (name, email).') );
     41                wp_die( __('Error: please fill the required fields (name, email).') );
    4242        elseif ( !is_email($comment_author_email))
    43                 die( __('Error: please enter a valid email address.') );
     43                wp_die( __('Error: please enter a valid email address.') );
    4444}
    4545
    4646if ( '' == $comment_content )
    47         die( __('Error: please type a comment.') );
     47        wp_die( __('Error: please type a comment.') );
    4848
    4949$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'user_ID');
    5050