WordPress.org

Make WordPress Core

Ticket #39028: 39028.patch

File 39028.patch, 1.9 KB (added by imath, 4 years ago)
  • src/wp-includes/comment.php

    diff --git src/wp-includes/comment.php src/wp-includes/comment.php
    index d530699..0c121b2 100644
    function wp_handle_comment_submission( $comment_data ) { 
    29612961                 */
    29622962                do_action( 'comment_id_not_found', $comment_post_ID );
    29632963
    2964                 return new WP_Error( 'comment_id_not_found' );
     2964                return new WP_Error( 'comment_id_not_found', __( 'Sorry, the item you try to comment on does not exist anymore.' ), 403 );
    29652965
    29662966        }
    29672967
    function wp_handle_comment_submission( $comment_data ) { 
    29692969        $status = get_post_status( $post );
    29702970
    29712971        if ( ( 'private' == $status ) && ! current_user_can( 'read_post', $comment_post_ID ) ) {
    2972                 return new WP_Error( 'comment_id_not_found' );
     2972                return new WP_Error( 'comment_on_private', __( 'Sorry, comments are not allowed for this item.' ), 403 );
    29732973        }
    29742974
    29752975        $status_obj = get_post_status_object( $status );
    function wp_handle_comment_submission( $comment_data ) { 
    29982998                 */
    29992999                do_action( 'comment_on_trash', $comment_post_ID );
    30003000
    3001                 return new WP_Error( 'comment_on_trash' );
     3001                return new WP_Error( 'comment_on_trash', __( 'Sorry, comments are not allowed for this item.' ), 403 );
    30023002
    30033003        } elseif ( ! $status_obj->public && ! $status_obj->private ) {
    30043004
    function wp_handle_comment_submission( $comment_data ) { 
    30113011                 */
    30123012                do_action( 'comment_on_draft', $comment_post_ID );
    30133013
    3014                 return new WP_Error( 'comment_on_draft' );
     3014                return new WP_Error( 'comment_on_draft', __( 'Sorry, comments are not allowed for this item.' ), 403 );
    30153015
    30163016        } elseif ( post_password_required( $comment_post_ID ) ) {
    30173017
    function wp_handle_comment_submission( $comment_data ) { 
    30243024                 */
    30253025                do_action( 'comment_on_password_protected', $comment_post_ID );
    30263026
    3027                 return new WP_Error( 'comment_on_password_protected' );
     3027                return new WP_Error( 'comment_on_password_protected', __( 'Sorry, comments are not allowed for this item.' ), 403 );
    30283028
    30293029        } else {
    30303030