Ticket #11329: 11329.004.diff
| File 11329.004.diff, 1.9 KB (added by cnorris23, 3 years ago) |
|---|
-
wp-admin/includes/template.php
2049 2049 $post = (int) $post; 2050 2050 $count = wp_count_comments(); 2051 2051 $index = ''; 2052 $userid = apply_filters( 'get_comment_list_by_user', '' ); 2052 2053 2053 2054 if ( 'moderated' == $status ) { 2054 2055 $approved = "c.comment_approved = '0'"; … … 2083 2084 $typesql = "AND ( c.comment_type = 'pingback' OR c.comment_type = 'trackback' )"; 2084 2085 elseif ( 'all' == $type ) 2085 2086 $typesql = ''; 2086 elseif ( ! empty($type) )2087 $typesql = $wpdb->prepare( "AND c.comment_type = %s", $type);2087 elseif ( ! empty( $type ) ) 2088 $typesql = $wpdb->prepare( "AND c.comment_type = %s", $type ); 2088 2089 else 2089 2090 $typesql = ''; 2090 2091 2091 if ( ! empty($type) )2092 if ( ! empty( $type ) ) 2092 2093 $total = ''; 2093 2094 2094 2095 $query = "FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' "; 2096 2097 if ( ! empty( $userid ) ) { 2098 $total = ''; 2099 if( ! is_array( $userid ) ) { 2100 $query .= "AND p.post_author = '$userid' "; 2101 } else { 2102 $query .= "AND p.post_author IN ( '" . implode( "', '", $userid ) . "' ) "; 2103 } 2104 } 2105 2095 2106 if ( $s ) { 2096 2107 $total = ''; 2097 $s = $wpdb->escape( $s);2108 $s = $wpdb->escape( $s ); 2098 2109 $query .= "AND 2099 2110 (c.comment_author LIKE '%$s%' OR 2100 2111 c.comment_author_email LIKE '%$s%' OR … … 2107 2118 $query .= "AND $approved $post $typesql"; 2108 2119 } 2109 2120 2110 $comments = $wpdb->get_results( "SELECT * $query $orderby");2121 $comments = $wpdb->get_results( "SELECT * $query $orderby" ); 2111 2122 if ( '' === $total ) 2112 $total = $wpdb->get_var( "SELECT COUNT(c.comment_ID) $query");2123 $total = $wpdb->get_var( "SELECT COUNT(c.comment_ID) $query" ); 2113 2124 2114 update_comment_cache( $comments);2125 update_comment_cache( $comments ); 2115 2126 2116 return array( $comments, $total);2127 return array( $comments, $total ); 2117 2128 } 2118 2129 2119 2130 /**
