From 3d87a487130426ee76955484f09ee3aea845d7b5 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 1 Oct 2008 15:48:45 +0000 Subject: [PATCH] Comment type filter from Viper007Bond. see #7552 git-svn-id: http://svn.automattic.com/wordpress/trunk@9046 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-comments.php | 32 +++++++++++++++++++++++++++++--- wp-admin/includes/template.php | 14 ++++++++++++-- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index cf87b68808..ba3a3f1d08 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -72,7 +72,9 @@ require_once('admin-header.php'); $mode = ( ! isset($_GET['mode']) || empty($_GET['mode']) ) ? 'detail' : attribute_escape($_GET['mode']); -$comment_status = isset($_GET['comment_status']) ? attribute_escape($_GET['comment_status']) : ''; +$comment_status = !empty($_GET['comment_status']) ? attribute_escape($_GET['comment_status']) : ''; + +$comment_type = !empty($_GET['comment_type']) ? attribute_escape($_GET['comment_type']) : ''; $post_id = isset($_GET['p']) ? (int) $_GET['p'] : 0; @@ -134,13 +136,14 @@ $stati = array( ); $class = ( '' === $comment_status ) ? ' class="current"' : ''; $status_links[] = "
  • ".__('Show All Comments').""; +$type = ( !$comment_type && 'all' != $comment_type ) ? '' : "&comment_type=$comment_type"; foreach ( $stati as $status => $label ) { $class = ''; if ( $status == $comment_status ) $class = ' class="current"'; - $status_links[] = "
  • $label"; + $status_links[] = "
  • $label"; } $status_links = apply_filters( 'comment_status_links', $status_links ); @@ -150,6 +153,29 @@ unset($status_links); ?> +
    +
    +\n"; ?> + + +
    +
    + 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);