WordPress.org

Make WordPress Core

Ticket #11329: 11329.007.diff

File 11329.007.diff, 2.7 KB (added by pampfelimetten, 8 years ago)
  • wp-admin/edit-comments.php

     
    261261
    262262$start = $offset = ( $page - 1 ) * $comments_per_page;
    263263
    264 list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 8, $post_id, $comment_type ); // Grab a few extra
     264$userid = apply_filters( 'get_comment_list_by_user', false );
    265265
     266list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 8, $post_id, $comment_type, $userid ); // Grab a few extra
     267
    266268$_comment_post_ids = array();
    267269foreach ( $_comments as $_c ) {
    268270        $_comment_post_ids[] = $_c->comment_post_ID;
  • wp-admin/admin-ajax.php

     
    689689        $start = isset($_POST['start']) ? intval($_POST['start']) : 0;
    690690        $num = isset($_POST['num']) ? intval($_POST['num']) : 10;
    691691
    692         list($comments, $total) = _wp_get_comment_list( false, false, $start, $num, $post_ID );
     692        $userid = apply_filters( 'get_comment_list_by_user', false );
    693693
     694        list($comments, $total) = _wp_get_comment_list( false, false, $start, $num, $post_ID, $userid );
     695
    694696        if ( !$comments )
    695697                die('1');
    696698
  • wp-admin/includes/template.php

     
    19491949 * @param int $num Maximum number of comments to return
    19501950 * @param int $post Post ID or 0 to return all comments
    19511951 * @param string $type Comment type (comment, trackback, pingback, etc)
     1952 * @param array $userid List only Comments to posts from a certain User
    19521953 * @return array [0] contains the comments and [1] contains the total number of comments that match (ignoring $start and $num)
    19531954 */
    1954 function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0, $type = '' ) {
     1955function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0, $type = '', $userid = array()) {
    19551956        global $wpdb;
    19561957
    19571958        $start = abs( (int) $start );
     
    20022003                $total = '';
    20032004
    20042005        $query = "FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ";
     2006
     2007        if ( $userid && ! empty( $userid ) && is_array( $userid )) {
     2008                $total = '';
     2009                $userids = array_map( 'absint', $userid );
     2010                $query .= "AND p.post_author IN ( '" . implode( "', '", $userids ) . "' ) ";
     2011        }
     2012
    20052013        if ( $s ) {
    20062014                $total = '';
    20072015                $s = $wpdb->escape($s);