WordPress.org

Make WordPress Core

Ticket #11286: 11286.diff

File 11286.diff, 2.7 KB (added by johnbillion, 7 years ago)
  • src/wp-comments-post.php

     
    4747         * @param int $comment_post_ID Post ID.
    4848         */
    4949        do_action( 'comment_closed', $comment_post_ID );
    50         wp_die( __('Sorry, comments are closed for this item.') );
     50        wp_die( __( 'Sorry, comments are closed for this item.' ), 403 );
    5151} elseif ( 'trash' == $status ) {
    5252        /**
    5353         * Fires when a comment is attempted on a trashed post.
     
    111111                }
    112112        }
    113113} else {
    114         if ( get_option('comment_registration') || 'private' == $status )
    115                 wp_die( __('Sorry, you must be logged in to post a comment.') );
     114        if ( get_option( 'comment_registration' ) || 'private' == $status ) {
     115                wp_die( __( 'Sorry, you must be logged in to post a comment.' ), 403 );
     116        }
    116117}
    117118
    118119$comment_type = '';
    119120
    120121if ( get_option('require_name_email') && !$user->exists() ) {
    121         if ( 6 > strlen($comment_author_email) || '' == $comment_author )
    122                 wp_die( __('<strong>ERROR</strong>: please fill the required fields (name, email).') );
    123         elseif ( !is_email($comment_author_email))
    124                 wp_die( __('<strong>ERROR</strong>: please enter a valid email address.') );
     122        if ( 6 > strlen( $comment_author_email ) || '' == $comment_author ) {
     123                wp_die( __( '<strong>ERROR</strong>: please fill the required fields (name, email).' ), 200 );
     124        } else if ( ! is_email( $comment_author_email ) ) {
     125                wp_die( __( '<strong>ERROR</strong>: please enter a valid email address.' ), 200 );
     126        }
    125127}
    126128
    127 if ( '' == $comment_content )
    128         wp_die( __('<strong>ERROR</strong>: please type a comment.') );
     129if ( '' == $comment_content ) {
     130        wp_die( __( '<strong>ERROR</strong>: please type a comment.' ), 200 );
     131}
    129132
    130133$comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0;
    131134
  • src/wp-includes/comment.php

     
    11271127                if ( defined( 'DOING_AJAX' ) ) {
    11281128                        die( __('Duplicate comment detected; it looks as though you&#8217;ve already said that!') );
    11291129                }
    1130                 wp_die( __('Duplicate comment detected; it looks as though you&#8217;ve already said that!') );
     1130                wp_die( __( 'Duplicate comment detected; it looks as though you&#8217;ve already said that!' ), 409 );
    11311131        }
    11321132
    11331133        /**
     
    12451245                        if ( defined('DOING_AJAX') )
    12461246                                die( __('You are posting comments too quickly. Slow down.') );
    12471247
    1248                         wp_die( __('You are posting comments too quickly. Slow down.'), '', array('response' => 403) );
     1248                        wp_die( __( 'You are posting comments too quickly. Slow down.' ), 429 );
    12491249                }
    12501250        }
    12511251}