Make WordPress Core

Ticket #4332: 4332.diff

File 4332.diff, 2.0 KB (added by wonderboymusic, 9 years ago)
  • src/wp-comments-post.php

     
    112112        }
    113113} else {
    114114        if ( get_option( 'comment_registration' ) || 'private' == $status ) {
    115                 wp_die( __( 'Sorry, you must be logged in to post a comment.' ), 403 );
     115                wp_die(
     116                        '<p>' . __( 'Sorry, you must be logged in to post a comment.' ) . '</p>' .
     117                        '<a href"javascript:history.back()">Back</a>',
     118                        403
     119                );
    116120        }
    117121}
    118122
     
    120124
    121125if ( get_option('require_name_email') && !$user->exists() ) {
    122126        if ( 6 > strlen( $comment_author_email ) || '' == $comment_author ) {
    123                 wp_die( __( '<strong>ERROR</strong>: please fill the required fields (name, email).' ), 200 );
     127                wp_die(
     128                        '<p>' . __( '<strong>ERROR</strong>: please fill the required fields (name, email).' ) . '</p>' .
     129                        '<a href="javascript:history.back()">Back</a>',
     130                        200
     131                );
    124132        } elseif ( ! is_email( $comment_author_email ) ) {
    125                 wp_die( __( '<strong>ERROR</strong>: please enter a valid email address.' ), 200 );
     133                wp_die(
     134                        '<p>' . __( '<strong>ERROR</strong>: please enter a valid email address.' ) . '</p>' .
     135                        '<a href="javascript:history.back()">Back</a>',
     136                        200
     137                );
    126138        }
    127139}
    128140
    129141if ( '' == $comment_content ) {
    130         wp_die( __( '<strong>ERROR</strong>: please type a comment.' ), 200 );
     142        wp_die(
     143                '<p>' . __( '<strong>ERROR</strong>: please type a comment.' ) . '</p>' .
     144                '<a href="javascript:history.back()">Back</a>',
     145                200
     146        );
    131147}
    132148
    133149$comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0;
     
    136152
    137153$comment_id = wp_new_comment( $commentdata );
    138154if ( ! $comment_id ) {
    139         wp_die( __( "<strong>ERROR</strong>: The comment could not be saved. Please try again later." ) );
     155        wp_die(
     156                '<p>' . __( "<strong>ERROR</strong>: The comment could not be saved. Please try again later." ) . '</p>' .
     157                '<a href="javascript:history.back()">Back</a>'
     158        );
    140159}
    141160
    142161$comment = get_comment( $comment_id );