Changeset 9023

Show
Ignore:
Timestamp:
09/28/08 17:48:55 (2 months ago)
Author:
ryan
Message:

Post ID filter for edit-comments

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/edit-comments.php

    r9018 r9023  
    6666$comment_status = isset($_GET['comment_status']) ? attribute_escape($_GET['comment_status']) : ''; 
    6767 
     68$post_id = isset($_GET['p']) ? (int) $_GET['p'] : 0; 
     69 
    6870$search_dirty = ( isset($_GET['s']) ) ? $_GET['s'] : ''; 
    6971$search = attribute_escape( $search_dirty ); ?> 
     
    152154$start = $offset = ( $page - 1 ) * $comments_per_page; 
    153155 
    154 list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 5 ); // Grab a few extra 
     156list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 5, $post_id ); // Grab a few extra 
    155157 
    156158$comments = array_slice($_comments, 0, $comments_per_page); 
  • trunk/wp-admin/includes/template.php

    r9022 r9023  
    15301530} 
    15311531 
    1532 function _wp_get_comment_list( $status = '', $s = false, $start, $num ) { 
     1532function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0 ) { 
    15331533    global $wpdb; 
    15341534 
    15351535    $start = abs( (int) $start ); 
    15361536    $num = (int) $num; 
     1537    $post = (int) $post; 
    15371538 
    15381539    if ( 'moderated' == $status ) 
     
    15441545    else 
    15451546        $approved = "( comment_approved = '0' OR comment_approved = '1' )"; 
     1547 
     1548    if ( $post ) 
     1549        $post = " AND comment_post_ID = '$post'"; 
     1550    else 
     1551        $post = ''; 
    15461552 
    15471553    if ( $s ) { 
     
    15561562            ORDER BY comment_date_gmt DESC LIMIT $start, $num"); 
    15571563    } else { 
    1558         $comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE $approved ORDER BY comment_date_gmt DESC LIMIT $start, $num" ); 
     1564        $comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE $approved $post ORDER BY comment_date_gmt DESC LIMIT $start, $num" ); 
    15591565    } 
    15601566