@@ 389-394 (lines=6) @@ | ||
386 | $query = "SELECT comment_approved, COUNT( * ) AS total FROM {$wpdb->comments} WHERE comment_type = %s "; |
|
387 | ||
388 | // Restrict to specific posts |
|
389 | if ( isset( $args['post__in'] ) && !empty( $args['post__in'] ) && is_array( $args['post__in'] ) ) { |
|
390 | $query .= ' AND comment_post_ID IN (' . implode( ',', array_map( 'absint', $args['post__in'] ) ) . ')'; |
|
391 | } |
|
392 | elseif ( !empty( $args['post_id'] ) ) { |
|
393 | $query .= $wpdb->prepare( ' AND comment_post_ID = %d', $args['post_id'] ); |
|
394 | } |
|
395 | // Restrict to specific users |
|
396 | if ( isset( $args['user_id'] ) && is_array( $args['user_id'] ) ) { |
|
397 | $query .= ' AND user_id IN (' . implode( ',', array_map( 'absint', $args['user_id'] ) ) . ')'; |
|
@@ 396-401 (lines=6) @@ | ||
393 | $query .= $wpdb->prepare( ' AND comment_post_ID = %d', $args['post_id'] ); |
|
394 | } |
|
395 | // Restrict to specific users |
|
396 | if ( isset( $args['user_id'] ) && is_array( $args['user_id'] ) ) { |
|
397 | $query .= ' AND user_id IN (' . implode( ',', array_map( 'absint', $args['user_id'] ) ) . ')'; |
|
398 | } |
|
399 | elseif ( !empty( $args['user_id'] ) ) { |
|
400 | $query .= $wpdb->prepare( ' AND user_id = %d', $args['user_id'] ); |
|
401 | } |
|
402 | $query .= ' GROUP BY comment_approved'; |
|
403 | ||
404 | $counts = wp_cache_get( $cache_key, 'counts' ); |