WordPress.org

Make WordPress Core

Ticket #11286: fix-http-status-in-comments.patch

File fix-http-status-in-comments.patch, 1.6 KB (added by miqrogroove, 5 years ago)
  • wp-comments-post.php

     
    2626        exit; 
    2727} elseif ( !comments_open($comment_post_ID) ) { 
    2828        do_action('comment_closed', $comment_post_ID); 
    29         wp_die( __('Sorry, comments are closed for this item.') ); 
     29        wp_die( __('Sorry, comments are closed for this item.'), '', array('response' => 403) ); 
    3030} elseif ( in_array($status->post_status, array('draft', 'pending') ) ) { 
    3131        do_action('comment_on_draft', $comment_post_ID); 
    3232        exit; 
     
    5858        } 
    5959} else { 
    6060        if ( get_option('comment_registration') || 'private' == $status->post_status ) 
    61                 wp_die( __('Sorry, you must be logged in to post a comment.') ); 
     61                wp_die( __('Sorry, you must be logged in to post a comment.'), '', array('response' => 403) ); 
    6262} 
    6363 
    6464$comment_type = ''; 
    6565 
    6666if ( get_option('require_name_email') && !$user->ID ) { 
    6767        if ( 6 > strlen($comment_author_email) || '' == $comment_author ) 
    68                 wp_die( __('Error: please fill the required fields (name, email).') ); 
     68                wp_die( __('Error: please fill the required fields (name, email).'), '', array('response' => 200) ); 
    6969        elseif ( !is_email($comment_author_email)) 
    70                 wp_die( __('Error: please enter a valid email address.') ); 
     70                wp_die( __('Error: please enter a valid email address.'), '', array('response' => 200) ); 
    7171} 
    7272 
    7373if ( '' == $comment_content ) 
    74         wp_die( __('Error: please type a comment.') ); 
     74        wp_die( __('Error: please type a comment.'), '', array('response' => 200) ); 
    7575 
    7676$comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0; 
    7777