Make WordPress Core

Ticket #30259: wp-comments-post.php.patch

File wp-comments-post.php.patch, 1.3 KB (added by Bondars Aleksandr, 10 years ago)

Patch wp-comments-post.php

  • wp-comments-post.php

     
    119119$comment_type = '';
    120120
    121121if ( get_option('require_name_email') && !$user->exists() ) {
    122         if ( 6 > strlen($comment_author_email) || '' == $comment_author )
     122        if ( 6 > strlen($comment_author_email) || '' == $comment_author ){
     123                do_action('comment_name_error');
    123124                wp_die( __('<strong>ERROR</strong>: please fill the required fields (name, email).') );
    124         elseif ( !is_email($comment_author_email))
     125        }elseif ( !is_email($comment_author_email)){
     126                do_action('comment_email_error');
    125127                wp_die( __('<strong>ERROR</strong>: please enter a valid email address.') );
     128        }
    126129}
    127130
    128 if ( '' == $comment_content )
     131if ( '' == $comment_content ){
     132        do_action('comment_content_error');
    129133        wp_die( __('<strong>ERROR</strong>: please type a comment.') );
     134}
    130135
    131136$comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0;
    132137
     
    134139
    135140$comment_id = wp_new_comment( $commentdata );
    136141if ( ! $comment_id ) {
     142        do_action('comment_save_error');
    137143        wp_die( __( "<strong>ERROR</strong>: The comment could not be saved. Please try again later." ) );
    138144}
    139145