WordPress.org

Make WordPress Core

Ticket #36302: 36302.diff

File 36302.diff, 1.1 KB (added by dshanske, 4 years ago)

Initial Patch

  • src/wp-includes/comment.php

    diff --git src/wp-includes/comment.php src/wp-includes/comment.php
    index ef4b553..9013993 100644
    function wp_update_comment($commentarr) { 
    20252025        $comment_post_ID = $data['comment_post_ID'];
    20262026        $keys = array( 'comment_post_ID', 'comment_content', 'comment_author', 'comment_author_email', 'comment_approved', 'comment_karma', 'comment_author_url', 'comment_date', 'comment_date_gmt', 'comment_type', 'comment_parent', 'user_id', 'comment_agent', 'comment_author_IP' );
    20272027        $data = wp_array_slice_assoc( $data, $keys );
     2028        /**
     2029         * Filter the comment before it is updated in the database.
     2030         * Data being passed to the filter is already unslashed.
     2031         *
     2032         * @since 4.7.0
     2033         *
     2034         * @param string $data The comment waiting to enter the database.
     2035         * @param string $comment The old comment data
     2036         * @param string $commentarr The new comment data
     2037         */
     2038        $data = apply_filters( 'pre_update_comment', $data, $comment, $commentarr);
     2039
    20282040        $rval = $wpdb->update( $wpdb->comments, $data, compact( 'comment_ID' ) );
    20292041
    20302042        clean_comment_cache( $comment_ID );