WordPress 4.7.1
[autoinstalls/wordpress.git] / wp-includes / comment.php
index 8bb2e9eb3c1e91dcf11ce499782f0b7531bc6dda..ba60070fd7d35e8f7fe45be1ef86d7d1bb51c3c7 100644 (file)
@@ -1003,12 +1003,6 @@ function get_page_of_comment( $comment_ID, $args = array() ) {
                if ( $args['max_depth'] > 1 && 0 != $comment->comment_parent )
                        return get_page_of_comment( $comment->comment_parent, $args );
 
-               if ( 'desc' === get_option( 'comment_order' ) ) {
-                       $compare = 'after';
-               } else {
-                       $compare = 'before';
-               }
-
                $comment_args = array(
                        'type'       => $args['type'],
                        'post_id'    => $comment->comment_post_ID,
@@ -1019,7 +1013,7 @@ function get_page_of_comment( $comment_ID, $args = array() ) {
                        'date_query' => array(
                                array(
                                        'column' => "$wpdb->comments.comment_date_gmt",
-                                       $compare => $comment->comment_date_gmt,
+                                       'before' => $comment->comment_date_gmt,
                                )
                        ),
                );
@@ -2186,8 +2180,6 @@ function wp_update_comment($commentarr) {
 
        $comment_ID = $data['comment_ID'];
        $comment_post_ID = $data['comment_post_ID'];
-       $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' );
-       $data = wp_array_slice_assoc( $data, $keys );
 
        /**
         * Filters the comment data immediately before it is updated in the database.
@@ -2202,6 +2194,9 @@ function wp_update_comment($commentarr) {
         */
        $data = apply_filters( 'wp_update_comment_data', $data, $comment, $commentarr );
 
+       $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' );
+       $data = wp_array_slice_assoc( $data, $keys );
+
        $rval = $wpdb->update( $wpdb->comments, $data, compact( 'comment_ID' ) );
 
        clean_comment_cache( $comment_ID );