Post ID filter for edit-comments

git-svn-id: https://develop.svn.wordpress.org/trunk@9023 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2008-09-28 17:48:55 +00:00
parent 7963d3dc22
commit a2e4747749
2 changed files with 11 additions and 3 deletions
+8 -2
View File
@@ -1529,11 +1529,12 @@ function user_row( $user_object, $style = '', $role = '' ) {
return $r;
}
function _wp_get_comment_list( $status = '', $s = false, $start, $num ) {
function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0 ) {
global $wpdb;
$start = abs( (int) $start );
$num = (int) $num;
$post = (int) $post;
if ( 'moderated' == $status )
$approved = "comment_approved = '0'";
@@ -1544,6 +1545,11 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num ) {
else
$approved = "( comment_approved = '0' OR comment_approved = '1' )";
if ( $post )
$post = " AND comment_post_ID = '$post'";
else
$post = '';
if ( $s ) {
$s = $wpdb->escape($s);
$comments = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE
@@ -1555,7 +1561,7 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num ) {
$approved
ORDER BY comment_date_gmt DESC LIMIT $start, $num");
} else {
$comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE $approved ORDER BY comment_date_gmt DESC LIMIT $start, $num" );
$comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE $approved $post ORDER BY comment_date_gmt DESC LIMIT $start, $num" );
}
update_comment_cache($comments);