WordPress.org

Make WordPress Core

Ticket #16252: 16252v2.diff

File 16252v2.diff, 3.3 KB (added by MattyRob, 3 years ago)
  • wp-admin/includes/comment.php

     
    4242        $_POST['comment_approved'] = $_POST['comment_status']; 
    4343        $_POST['comment_content'] = $_POST['content']; 
    4444        $_POST['comment_ID'] = (int) $_POST['comment_ID']; 
     45        $_POST['comment_parent'] = (int) $_POST['newcomment_parent']; 
    4546 
    4647        foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) { 
    4748                if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) { 
     
    8990        $comment->comment_author_email = format_to_edit( $comment->comment_author_email ); 
    9091        $comment->comment_author_url = format_to_edit( $comment->comment_author_url ); 
    9192        $comment->comment_author_url = esc_url($comment->comment_author_url); 
     93        $comment->comment_parent = (int) $comment->comment_parent; 
    9294 
    9395        return $comment; 
    9496} 
  • wp-admin/edit-form-comment.php

     
    5555                } ?></td> 
    5656        <td><input type="text" id="newcomment_author_url" name="newcomment_author_url" size="30" class="code" value="<?php echo esc_attr($comment->comment_author_url); ?>" tabindex="3" /></td> 
    5757</tr> 
     58<tr valign="top"> 
     59        <td class="first"> 
     60        <?php _e( 'Comment Parent' );?> 
     61        </td> 
     62        <td> 
     63        <input type="text" id="newcomment_parent" name="newcomment_parent" size="5" class="code" value="<?php echo esc_attr($comment->comment_parent); ?>" tabindex="4" /> 
     64        </td> 
     65</tr> 
    5866</tbody> 
    5967</table> 
    6068<br /> 
  • wp-includes/comment.php

     
    13311331 * @uses wp_filter_comment() Used to filter comment before adding comment. 
    13321332 * @uses wp_allow_comment() checks to see if comment is approved. 
    13331333 * @uses wp_insert_comment() Does the actual comment insertion to the database. 
     1334 * @uses wp_transition_comment_status() Passes new and old comment status along with $comment object 
    13341335 * 
    13351336 * @param array $commentdata Contains information on the comment. 
    13361337 * @return int The ID of the comment after adding. 
     
    13611362        $comment_ID = wp_insert_comment($commentdata); 
    13621363 
    13631364        do_action('comment_post', $comment_ID, $commentdata['comment_approved']); 
     1365        wp_transition_comment_status($commentdata['comment_approved'], 'new', (object)$commentdata); 
    13641366 
    13651367        if ( 'spam' !== $commentdata['comment_approved'] ) { // If it's spam save it silently for later crunching 
    13661368                if ( '0' == $commentdata['comment_approved'] ) 
     
    14791481        else if ( 'approve' == $comment_approved ) 
    14801482                $comment_approved = 1; 
    14811483 
    1482         $data = compact('comment_content', 'comment_author', 'comment_author_email', 'comment_approved', 'comment_karma', 'comment_author_url', 'comment_date', 'comment_date_gmt'); 
     1484        $data = compact('comment_content', 'comment_author', 'comment_author_email', 'comment_approved', 'comment_karma', 'comment_author_url', 'comment_date', 'comment_date_gmt', 'comment_parent'); 
    14831485        $rval = $wpdb->update( $wpdb->comments, $data, compact( 'comment_ID' ) ); 
    14841486 
    14851487        clean_comment_cache($comment_ID);