Ticket #11329: 11329.006.diff
File 11329.006.diff, 2.0 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/template.php
1926 1926 $post = (int) $post; 1927 1927 $count = wp_count_comments(); 1928 1928 $index = ''; 1929 $userid = apply_filters( 'get_comment_list_by_user', false ); 1929 1930 1930 1931 if ( 'moderated' == $status ) { 1931 1932 $approved = "c.comment_approved = '0'"; … … 1960 1961 $typesql = "AND ( c.comment_type = 'pingback' OR c.comment_type = 'trackback' )"; 1961 1962 elseif ( 'all' == $type ) 1962 1963 $typesql = ''; 1963 elseif ( ! empty($type) )1964 $typesql = $wpdb->prepare( "AND c.comment_type = %s", $type);1964 elseif ( ! empty( $type ) ) 1965 $typesql = $wpdb->prepare( "AND c.comment_type = %s", $type ); 1965 1966 else 1966 1967 $typesql = ''; 1967 1968 1968 if ( ! empty($type) )1969 if ( ! empty( $type ) ) 1969 1970 $total = ''; 1970 1971 1971 1972 $query = "FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' "; 1973 1974 if ( $userid && ! empty( $userid ) ) { 1975 $total = ''; 1976 if( ! is_array( $userid ) ) { 1977 $userid = absint( $userid ); 1978 $query .= "AND p.post_author = '$userid' "; 1979 } else { 1980 $userids = array_map( 'absint', $userid ); 1981 $query .= "AND p.post_author IN ( '" . implode( "', '", $userids ) . "' ) "; 1982 } 1983 } 1984 1972 1985 if ( $s ) { 1973 1986 $total = ''; 1974 $s = $wpdb->escape( $s);1987 $s = $wpdb->escape( $s ); 1975 1988 $query .= "AND 1976 1989 (c.comment_author LIKE '%$s%' OR 1977 1990 c.comment_author_email LIKE '%$s%' OR … … 1984 1997 $query .= "AND $approved $post $typesql"; 1985 1998 } 1986 1999 1987 $comments = $wpdb->get_results( "SELECT * $query $orderby");2000 $comments = $wpdb->get_results( "SELECT * $query $orderby" ); 1988 2001 if ( '' === $total ) 1989 $total = $wpdb->get_var( "SELECT COUNT(c.comment_ID) $query");2002 $total = $wpdb->get_var( "SELECT COUNT(c.comment_ID) $query" ); 1990 2003 1991 update_comment_cache( $comments);2004 update_comment_cache( $comments ); 1992 2005 1993 return array( $comments, $total);2006 return array( $comments, $total ); 1994 2007 } 1995 2008 1996 2009 /**