mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-04 17:20:07 +00:00
Comment type filter from Viper007Bond. see #7552
git-svn-id: https://develop.svn.wordpress.org/trunk@9046 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1531,7 +1531,7 @@ function user_row( $user_object, $style = '', $role = '' ) {
|
||||
return $r;
|
||||
}
|
||||
|
||||
function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0 ) {
|
||||
function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0, $type = '' ) {
|
||||
global $wpdb;
|
||||
|
||||
$start = abs( (int) $start );
|
||||
@@ -1552,6 +1552,15 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0
|
||||
else
|
||||
$post = '';
|
||||
|
||||
if ( 'comment' == $type )
|
||||
$typesql = "AND comment_type = ''";
|
||||
elseif ( 'pingback' == $type )
|
||||
$typesql = "AND comment_type = 'pingback'";
|
||||
elseif ( 'trackback' == $type )
|
||||
$typesql = "AND comment_type = 'trackback'";
|
||||
else
|
||||
$typesql = '';
|
||||
|
||||
if ( $s ) {
|
||||
$s = $wpdb->escape($s);
|
||||
$comments = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE
|
||||
@@ -1561,9 +1570,10 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0
|
||||
comment_author_IP LIKE ('%$s%') OR
|
||||
comment_content LIKE ('%$s%') ) AND
|
||||
$approved
|
||||
$typesql
|
||||
ORDER BY comment_date_gmt DESC LIMIT $start, $num");
|
||||
} else {
|
||||
$comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE $approved $post ORDER BY comment_date_gmt DESC LIMIT $start, $num" );
|
||||
$comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE $approved $post $typesql ORDER BY comment_date_gmt DESC LIMIT $start, $num" );
|
||||
}
|
||||
|
||||
update_comment_cache($comments);
|
||||
|
||||
Reference in New Issue
Block a user