Ticket #12668: 12668-3.patch
File 12668-3.patch, 2.0 KB (added by , 10 years ago) |
---|
-
src/wp-admin/includes/class-wp-comments-list-table.php
109 109 'orderby' => $orderby, 110 110 'order' => $order, 111 111 'post_type' => $post_type, 112 'type' => array( 'pingback', 'tracback', 'comment' ) 112 113 ); 113 114 114 115 $_comments = get_comments( $args ); -
src/wp-includes/comment.php
131 131 * @uses $wpdb 132 132 * 133 133 * @param int $post_id The ID of the post 134 * @param string $comment_type The type of comment to get 134 135 * @return array $comments The approved comments 135 136 */ 136 function get_approved_comments( $post_id) {137 function get_approved_comments( $post_id, $comment_type = '' ) { 137 138 global $wpdb; 138 return $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1' ORDER BY comment_date", $post_id)); 139 140 $type = ""; 141 if( ! empty( $comment_type ) ) { 142 $type = " AND comment_type = '%s'"; 143 } 144 145 return $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'$type ORDER BY comment_date", $post_id, $comment_type ) ); 139 146 } 140 147 141 148 /** … … 447 454 } elseif( 'pings' == $this->query_vars['type'] ) { 448 455 $where .= ' AND comment_type IN ("pingback", "trackback")'; 449 456 } elseif ( ! empty( $this->query_vars['type'] ) ) { 450 $where .= $wpdb->prepare( ' AND comment_type = %s', $this->query_vars['type'] ); 457 458 if( is_array( $this->query_vars['type'] ) ) { 459 460 $where .= ' AND comment_type IN ("' . implode( '","', $this->query_vars['type'] ) . ',","")'; 461 462 } else { 463 464 $where .= $wpdb->prepare( ' AND comment_type = %s', $this->query_vars['type'] ); 465 466 } 451 467 } 452 468 453 469 if ( '' !== $this->query_vars['parent'] ) {