<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[15630] trunk/wp-admin: WP_Comments_Table cleanup:</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/15630">15630</a></dd>
<dt>Author</dt> <dd>scribu</dd>
<dt>Date</dt> <dd>2010-09-18 17:46:29 +0000 (Sat, 18 Sep 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>WP_Comments_Table cleanup:
        * use column_*() methods
        * remove extra arguments from single_row()
        * introduce derived class WP_Post_Comments_Table for handling the post metabox comments
        * use $pending_count property instead of $_comment_pending_count global
See <a href="http://trac.wordpress.org/ticket/14579">#14579</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminadminajaxphp">trunk/wp-admin/admin-ajax.php</a></li>
<li><a href="#trunkwpadminincludesdefaultlisttablesphp">trunk/wp-admin/includes/default-list-tables.php</a></li>
<li><a href="#trunkwpadminincludesmetaboxesphp">trunk/wp-admin/includes/meta-boxes.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminadminajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/admin-ajax.php (15629 => 15630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/admin-ajax.php        2010-09-18 17:21:32 UTC (rev 15629)
+++ trunk/wp-admin/admin-ajax.php        2010-09-18 17:46:29 UTC (rev 15630)
</span><span class="lines">@@ -624,6 +624,8 @@
</span><span class="cx">                 die('-1');
</span><span class="cx"> 
</span><span class="cx">         $wp_list_table = get_list_table('comments');
</span><ins>+        $wp_list_table-&gt;from_ajax = true;
+
</ins><span class="cx">         $wp_list_table-&gt;prepare_items();
</span><span class="cx"> 
</span><span class="cx">         if ( !$wp_list_table-&gt;has_items() )
</span><span class="lines">@@ -631,9 +633,8 @@
</span><span class="cx"> 
</span><span class="cx">         $x = new WP_Ajax_Response();
</span><span class="cx">         foreach ( $wp_list_table-&gt;items as $comment ) {
</span><del>-                get_comment( $comment );
</del><span class="cx">                 ob_start();
</span><del>-                        $wp_list_table-&gt;single_row( $comment-&gt;comment_ID, $mode, $comment_status, true, true );
</del><ins>+                        $wp_list_table-&gt;single_row( $comment );
</ins><span class="cx">                         $comment_list_item = ob_get_contents();
</span><span class="cx">                 ob_end_clean();
</span><span class="cx">                 $x-&gt;add( array(
</span><span class="lines">@@ -651,7 +652,8 @@
</span><span class="cx">         if ( !current_user_can( 'edit_post', $post_ID ) )
</span><span class="cx">                 die('-1');
</span><span class="cx"> 
</span><del>-        $wp_list_table = get_list_table('comments');
</del><ins>+        $wp_list_table = get_list_table('post-comments');
+
</ins><span class="cx">         $wp_list_table-&gt;prepare_items();
</span><span class="cx"> 
</span><span class="cx">         if ( !$wp_list_table-&gt;has_items() )
</span><span class="lines">@@ -662,7 +664,7 @@
</span><span class="cx">         foreach ( $wp_list_table-&gt;items as $comment ) {
</span><span class="cx">                 get_comment( $comment );
</span><span class="cx">                 ob_start();
</span><del>-                        $wp_list_table-&gt;single_row( $comment-&gt;comment_ID, 'single', false, false );
</del><ins>+                        $wp_list_table-&gt;single_row( $comment );
</ins><span class="cx">                         $comment_list_item .= ob_get_contents();
</span><span class="cx">                 ob_end_clean();
</span><span class="cx">         }
</span><span class="lines">@@ -676,6 +678,7 @@
</span><span class="cx">         check_ajax_referer( $action, '_ajax_nonce-replyto-comment' );
</span><span class="cx"> 
</span><span class="cx">         $wp_list_table = get_list_table('comments');
</span><ins>+        $wp_list_table-&gt;checkbox = ( isset($_POST['checkbox']) &amp;&amp; true == $_POST['checkbox'] ) ? 1 : 0;
</ins><span class="cx"> 
</span><span class="cx">         $comment_post_ID = (int) $_POST['comment_post_ID'];
</span><span class="cx">         if ( !current_user_can( 'edit_post', $comment_post_ID ) )
</span><span class="lines">@@ -715,16 +718,15 @@
</span><span class="cx">         if ( ! $comment ) die('1');
</span><span class="cx"> 
</span><span class="cx">         $position = ( isset($_POST['position']) &amp;&amp; (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
</span><del>-        $checkbox = ( isset($_POST['checkbox']) &amp;&amp; true == $_POST['checkbox'] ) ? 1 : 0;
</del><span class="cx"> 
</span><span class="cx">         $x = new WP_Ajax_Response();
</span><span class="cx"> 
</span><span class="cx">         ob_start();
</span><span class="cx">                 if ( 'dashboard' == $mode ) {
</span><span class="cx">                         require_once( ABSPATH . 'wp-admin/includes/dashboard.php' );
</span><del>-                        _wp_dashboard_recent_comments_row( $comment, false );
</del><ins>+                        _wp_dashboard_recent_comments_row( $comment );
</ins><span class="cx">                 } else {
</span><del>-                        $wp_list_table-&gt;single_row( $comment-&gt;comment_ID, $mode, false, $checkbox );
</del><ins>+                        $wp_list_table-&gt;single_row( $comment );
</ins><span class="cx">                 }
</span><span class="cx">                 $comment_list_item = ob_get_contents();
</span><span class="cx">         ob_end_clean();
</span><span class="lines">@@ -753,13 +755,13 @@
</span><span class="cx">         edit_comment();
</span><span class="cx"> 
</span><span class="cx">         $position = ( isset($_POST['position']) &amp;&amp; (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
</span><ins>+        $comments_status = isset($_POST['comments_listing']) ? $_POST['comments_listing'] : '';
+
</ins><span class="cx">         $checkbox = ( isset($_POST['checkbox']) &amp;&amp; true == $_POST['checkbox'] ) ? 1 : 0;
</span><del>-        $comments_listing = isset($_POST['comments_listing']) ? $_POST['comments_listing'] : '';
</del><ins>+        $wp_list_table = get_list_table( $checkbox ? 'comments' : 'post-comments' );
</ins><span class="cx"> 
</span><del>-        $wp_list_table = get_list_table('comments');
-
</del><span class="cx">         ob_start();
</span><del>-                $wp_list_table-&gt;single_row( $comment_id, $mode, $comments_listing, $checkbox );
</del><ins>+                $wp_list_table-&gt;single_row( get_comment( $comment_id ) );
</ins><span class="cx">                 $comment_list_item = ob_get_contents();
</span><span class="cx">         ob_end_clean();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminincludesdefaultlisttablesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/default-list-tables.php (15629 => 15630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/default-list-tables.php        2010-09-18 17:21:32 UTC (rev 15629)
+++ trunk/wp-admin/includes/default-list-tables.php        2010-09-18 17:46:29 UTC (rev 15630)
</span><span class="lines">@@ -2015,6 +2015,11 @@
</span><span class="cx"> 
</span><span class="cx"> class WP_Comments_Table extends WP_List_Table {
</span><span class="cx"> 
</span><ins>+        var $checkbox = true;
+        var $from_ajax = false;
+
+        var $pending_count = array();
+
</ins><span class="cx">         function WP_Comments_Table() {
</span><span class="cx">                 global $mode;
</span><span class="cx"> 
</span><span class="lines">@@ -2091,7 +2096,7 @@
</span><span class="cx">                         $_comment_post_ids[] = $_c-&gt;comment_post_ID;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                $_comment_pending_count = get_pending_comments_num( $_comment_post_ids );
</del><ins>+                $this-&gt;pending_count = get_pending_comments_num( $_comment_post_ids );
</ins><span class="cx"> 
</span><span class="cx">                 $this-&gt;set_pagination_args( array(
</span><span class="cx">                         'total_items' =&gt; $total_comments,
</span><span class="lines">@@ -2205,13 +2210,20 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function get_columns() {
</span><del>-                return array(
-                        'cb'       =&gt; '&lt;input type=&quot;checkbox&quot; /&gt;',
-                        'author'   =&gt; __( 'Author' ),
-                        /* translators: column name */
-                        'comment'  =&gt; _x( 'Comment', 'column name' ),
-                        'response' =&gt; __( 'In Response To' )
-                );
</del><ins>+                global $mode;
+
+                $columns = array();
+
+                if ( $this-&gt;checkbox )
+                        $columns['cb'] = '&lt;input type=&quot;checkbox&quot; /&gt;';
+
+                $columns['author'] = __( 'Author' );
+                $columns['comment'] = _x( 'Comment', 'column name' );
+
+                if ( 'single' !== $mode )
+                        $columns['response'] = _x( 'Comment', 'column name' );
+
+                return $columns;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function get_sortable_columns() {
</span><span class="lines">@@ -2242,11 +2254,11 @@
</span><span class="cx">         &lt;/tfoot&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;tbody id=&quot;the-comment-list&quot; class=&quot;list:comment&quot;&gt;
</span><del>-                &lt;?php $this-&gt;display_rows( $this-&gt;items ); ?&gt;
</del><ins>+                &lt;?php $this-&gt;display_rows(); ?&gt;
</ins><span class="cx">         &lt;/tbody&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;tbody id=&quot;the-extra-comment-list&quot; class=&quot;list:comment&quot; style=&quot;display: none;&quot;&gt;
</span><del>-                &lt;?php $this-&gt;display_rows( $this-&gt;extra_items ); ?&gt;
</del><ins>+                &lt;?php $this-&gt;items = $this-&gt;extra_items; $this-&gt;display_rows(); ?&gt;
</ins><span class="cx">         &lt;/tbody&gt;
</span><span class="cx"> &lt;/table&gt;
</span><span class="cx"> &lt;?php
</span><span class="lines">@@ -2254,30 +2266,32 @@
</span><span class="cx">                 $this-&gt;display_tablenav( 'bottom' );
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function display_rows( $items = false ) {
-                global $mode, $comment_status;
</del><ins>+        function single_row( $a_comment ) {
+                global $post, $comment, $the_comment_status;
</ins><span class="cx"> 
</span><del>-                if ( false === $items )
-                        $items = $this-&gt;items;
</del><ins>+                $comment = $a_comment;
+                $the_comment_status = wp_get_comment_status( $comment-&gt;comment_ID );
</ins><span class="cx"> 
</span><del>-                foreach ( $items as $comment )
-                        $this-&gt;single_row( $comment-&gt;comment_ID, $mode, $comment_status );
</del><ins>+                $post = get_post( $comment-&gt;comment_post_ID );
+
+                $this-&gt;user_can = current_user_can( 'edit_comment', $comment-&gt;comment_ID );
+
+                echo &quot;&lt;tr id='comment-$comment-&gt;comment_ID' class='$the_comment_status'&gt;&quot;;
+                echo $this-&gt;single_row_columns( $comment );
+                echo &quot;&lt;/tr&gt;\n&quot;;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function single_row( $comment_id, $mode, $comment_status, $checkbox = true, $from_ajax = false ) {
-                global $comment, $post, $_comment_pending_count;
-                $comment = get_comment( $comment_id );
-                $post = get_post( $comment-&gt;comment_post_ID );
-                $the_comment_status = wp_get_comment_status( $comment-&gt;comment_ID );
-                $user_can = current_user_can( 'edit_comment', $comment_id );
</del><ins>+        function column_cb( $comment ) {
+                if ( $this-&gt;user_can )
+                        echo &quot;&lt;input type='checkbox' name='delete_comments[]' value='$comment-&gt;comment_ID' /&gt;&quot;;
+        }
</ins><span class="cx"> 
</span><ins>+        function column_comment( $comment ) {
+                global $post, $comment_status, $the_comment_status;
+
+                $user_can = $this-&gt;user_can;
+
</ins><span class="cx">                 $comment_url = esc_url( get_comment_link( $comment-&gt;comment_ID ) );
</span><del>-                $author_url = get_comment_author_url();
-                if ( 'http://' == $author_url )
-                        $author_url = '';
-                $author_url_display = preg_replace( '|http://(www\.)?|i', '', $author_url );
-                if ( strlen( $author_url_display ) &gt; 50 )
-                        $author_url_display = substr( $author_url_display, 0, 49 ) . '...';
</del><span class="cx"> 
</span><span class="cx">                 $ptime = date( 'G', strtotime( $comment-&gt;comment_date ) );
</span><span class="cx">                 if ( ( abs( time() - $ptime ) ) &lt; 86400 )
</span><span class="lines">@@ -2300,181 +2314,178 @@
</span><span class="cx">                         $delete_url = esc_url( $url . &quot;&amp;action=deletecomment&amp;$del_nonce&quot; );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                echo &quot;&lt;tr id='comment-$comment-&gt;comment_ID' class='$the_comment_status'&gt;&quot;;
</del><ins>+                echo '&lt;div id=&quot;submitted-on&quot;&gt;';
+                /* translators: 2: comment date, 3: comment time */
+                printf( __( '&lt;a href=&quot;%1$s&quot;&gt;%2$s at %3$s&lt;/a&gt;' ), $comment_url,
+                        /* translators: comment date format. See http://php.net/date */ get_comment_date( __( 'Y/m/d' ) ),
+                        /* translators: comment time format. See http://php.net/date */ get_comment_date( get_option( 'time_format' ) ) );
</ins><span class="cx"> 
</span><del>-                list( $columns, $hidden ) = $this-&gt;get_column_headers();
</del><ins>+                if ( $comment-&gt;comment_parent ) {
+                        $parent = get_comment( $comment-&gt;comment_parent );
+                        $parent_link = esc_url( get_comment_link( $comment-&gt;comment_parent ) );
+                        $name = get_comment_author( $parent-&gt;comment_ID );
+                        printf( ' | '.__( 'In reply to &lt;a href=&quot;%1$s&quot;&gt;%2$s&lt;/a&gt;.' ), $parent_link, $name );
+                }
</ins><span class="cx"> 
</span><del>-                foreach ( $columns as $column_name =&gt; $column_display_name ) {
-                        $class = &quot;class=\&quot;$column_name column-$column_name\&quot;&quot;;
</del><ins>+                echo '&lt;/div&gt;';
+                comment_text();
+                if ( $user_can ) { ?&gt;
+                &lt;div id=&quot;inline-&lt;?php echo $comment-&gt;comment_ID; ?&gt;&quot; class=&quot;hidden&quot;&gt;
+                &lt;textarea class=&quot;comment&quot; rows=&quot;1&quot; cols=&quot;1&quot;&gt;&lt;?php echo esc_html( apply_filters( 'comment_edit_pre', $comment-&gt;comment_content ) ); ?&gt;&lt;/textarea&gt;
+                &lt;div class=&quot;author-email&quot;&gt;&lt;?php echo esc_attr( $comment-&gt;comment_author_email ); ?&gt;&lt;/div&gt;
+                &lt;div class=&quot;author&quot;&gt;&lt;?php echo esc_attr( $comment-&gt;comment_author ); ?&gt;&lt;/div&gt;
+                &lt;div class=&quot;author-url&quot;&gt;&lt;?php echo esc_attr( $comment-&gt;comment_author_url ); ?&gt;&lt;/div&gt;
+                &lt;div class=&quot;comment_status&quot;&gt;&lt;?php echo $comment-&gt;comment_approved; ?&gt;&lt;/div&gt;
+                &lt;/div&gt;
+                &lt;?php
+                }
</ins><span class="cx"> 
</span><del>-                        $style = '';
-                        if ( in_array( $column_name, $hidden ) )
-                                $style = ' style=&quot;display:none;&quot;';
</del><ins>+                if ( $user_can ) {
+                        // preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash
+                        $actions = array(
+                                'approve' =&gt; '', 'unapprove' =&gt; '',
+                                'reply' =&gt; '',
+                                'quickedit' =&gt; '',
+                                'edit' =&gt; '',
+                                'spam' =&gt; '', 'unspam' =&gt; '',
+                                'trash' =&gt; '', 'untrash' =&gt; '', 'delete' =&gt; ''
+                        );
</ins><span class="cx"> 
</span><del>-                        $attributes = &quot;$class$style&quot;;
</del><ins>+                        if ( $comment_status &amp;&amp; 'all' != $comment_status ) { // not looking at all comments
+                                if ( 'approved' == $the_comment_status )
+                                        $actions['unapprove'] = &quot;&lt;a href='$unapprove_url' class='delete:the-comment-list:comment-$comment-&gt;comment_ID:e7e7d3:action=dim-comment&amp;amp;new=unapproved vim-u vim-destructive' title='&quot; . esc_attr__( 'Unapprove this comment' ) . &quot;'&gt;&quot; . __( 'Unapprove' ) . '&lt;/a&gt;';
+                                else if ( 'unapproved' == $the_comment_status )
+                                        $actions['approve'] = &quot;&lt;a href='$approve_url' class='delete:the-comment-list:comment-$comment-&gt;comment_ID:e7e7d3:action=dim-comment&amp;amp;new=approved vim-a vim-destructive' title='&quot; . esc_attr__( 'Approve this comment' ) . &quot;'&gt;&quot; . __( 'Approve' ) . '&lt;/a&gt;';
+                        } else {
+                                $actions['approve'] = &quot;&lt;a href='$approve_url' class='dim:the-comment-list:comment-$comment-&gt;comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='&quot; . esc_attr__( 'Approve this comment' ) . &quot;'&gt;&quot; . __( 'Approve' ) . '&lt;/a&gt;';
+                                $actions['unapprove'] = &quot;&lt;a href='$unapprove_url' class='dim:the-comment-list:comment-$comment-&gt;comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='&quot; . esc_attr__( 'Unapprove this comment' ) . &quot;'&gt;&quot; . __( 'Unapprove' ) . '&lt;/a&gt;';
+                        }
</ins><span class="cx"> 
</span><del>-                        switch ( $column_name ) {
-                                case 'cb':
-                                        if ( !$checkbox ) break;
-                                        echo '&lt;th scope=&quot;row&quot; class=&quot;check-column&quot;&gt;';
-                                        if ( $user_can ) echo &quot;&lt;input type='checkbox' name='delete_comments[]' value='$comment-&gt;comment_ID' /&gt;&quot;;
-                                        echo '&lt;/th&gt;';
-                                        break;
-                                case 'comment':
-                                        echo &quot;&lt;td $attributes&gt;&quot;;
-                                        echo '&lt;div id=&quot;submitted-on&quot;&gt;';
-                                        /* translators: 2: comment date, 3: comment time */
-                                        printf( __( '&lt;a href=&quot;%1$s&quot;&gt;%2$s at %3$s&lt;/a&gt;' ), $comment_url,
-                                                /* translators: comment date format. See http://php.net/date */ get_comment_date( __( 'Y/m/d' ) ),
-                                                /* translators: comment time format. See http://php.net/date */ get_comment_date( get_option( 'time_format' ) ) );
</del><ins>+                        if ( 'spam' != $the_comment_status &amp;&amp; 'trash' != $the_comment_status ) {
+                                $actions['spam'] = &quot;&lt;a href='$spam_url' class='delete:the-comment-list:comment-$comment-&gt;comment_ID::spam=1 vim-s vim-destructive' title='&quot; . esc_attr__( 'Mark this comment as spam' ) . &quot;'&gt;&quot; . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '&lt;/a&gt;';
+                        } elseif ( 'spam' == $the_comment_status ) {
+                                $actions['unspam'] = &quot;&lt;a href='$unspam_url' class='delete:the-comment-list:comment-$comment-&gt;comment_ID:66cc66:unspam=1 vim-z vim-destructive'&gt;&quot; . _x( 'Not Spam', 'comment' ) . '&lt;/a&gt;';
+                        } elseif ( 'trash' == $the_comment_status ) {
+                                $actions['untrash'] = &quot;&lt;a href='$untrash_url' class='delete:the-comment-list:comment-$comment-&gt;comment_ID:66cc66:untrash=1 vim-z vim-destructive'&gt;&quot; . __( 'Restore' ) . '&lt;/a&gt;';
+                        }
</ins><span class="cx"> 
</span><del>-                                        if ( $comment-&gt;comment_parent ) {
-                                                $parent = get_comment( $comment-&gt;comment_parent );
-                                                $parent_link = esc_url( get_comment_link( $comment-&gt;comment_parent ) );
-                                                $name = get_comment_author( $parent-&gt;comment_ID );
-                                                printf( ' | '.__( 'In reply to &lt;a href=&quot;%1$s&quot;&gt;%2$s&lt;/a&gt;.' ), $parent_link, $name );
-                                        }
</del><ins>+                        if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) {
+                                $actions['delete'] = &quot;&lt;a href='$delete_url' class='delete:the-comment-list:comment-$comment-&gt;comment_ID::delete=1 delete vim-d vim-destructive'&gt;&quot; . __( 'Delete Permanently' ) . '&lt;/a&gt;';
+                        } else {
+                                $actions['trash'] = &quot;&lt;a href='$trash_url' class='delete:the-comment-list:comment-$comment-&gt;comment_ID::trash=1 delete vim-d vim-destructive' title='&quot; . esc_attr__( 'Move this comment to the trash' ) . &quot;'&gt;&quot; . _x( 'Trash', 'verb' ) . '&lt;/a&gt;';
+                        }
</ins><span class="cx"> 
</span><del>-                                        echo '&lt;/div&gt;';
-                                        comment_text();
-                                        if ( $user_can ) { ?&gt;
-                                        &lt;div id=&quot;inline-&lt;?php echo $comment-&gt;comment_ID; ?&gt;&quot; class=&quot;hidden&quot;&gt;
-                                        &lt;textarea class=&quot;comment&quot; rows=&quot;1&quot; cols=&quot;1&quot;&gt;&lt;?php echo esc_html( apply_filters( 'comment_edit_pre', $comment-&gt;comment_content ) ); ?&gt;&lt;/textarea&gt;
-                                        &lt;div class=&quot;author-email&quot;&gt;&lt;?php echo esc_attr( $comment-&gt;comment_author_email ); ?&gt;&lt;/div&gt;
-                                        &lt;div class=&quot;author&quot;&gt;&lt;?php echo esc_attr( $comment-&gt;comment_author ); ?&gt;&lt;/div&gt;
-                                        &lt;div class=&quot;author-url&quot;&gt;&lt;?php echo esc_attr( $comment-&gt;comment_author_url ); ?&gt;&lt;/div&gt;
-                                        &lt;div class=&quot;comment_status&quot;&gt;&lt;?php echo $comment-&gt;comment_approved; ?&gt;&lt;/div&gt;
-                                        &lt;/div&gt;
-                                        &lt;?php
-                                        }
</del><ins>+                        if ( 'trash' != $the_comment_status ) {
+                                $actions['edit'] = &quot;&lt;a href='comment.php?action=editcomment&amp;amp;c={$comment-&gt;comment_ID}' title='&quot; . esc_attr__( 'Edit comment' ) . &quot;'&gt;&quot;. __( 'Edit' ) . '&lt;/a&gt;';
+                                $actions['quickedit'] = '&lt;a onclick=&quot;commentReply.open( \''.$comment-&gt;comment_ID.'\',\''.$post-&gt;ID.'\',\'edit\' );return false;&quot; class=&quot;vim-q&quot; title=&quot;'.esc_attr__( 'Quick Edit' ).'&quot; href=&quot;#&quot;&gt;' . __( 'Quick&amp;nbsp;Edit' ) . '&lt;/a&gt;';
+                                if ( 'spam' != $the_comment_status )
+                                        $actions['reply'] = '&lt;a onclick=&quot;commentReply.open( \''.$comment-&gt;comment_ID.'\',\''.$post-&gt;ID.'\' );return false;&quot; class=&quot;vim-r&quot; title=&quot;'.esc_attr__( 'Reply to this comment' ).'&quot; href=&quot;#&quot;&gt;' . __( 'Reply' ) . '&lt;/a&gt;';
+                        }
</ins><span class="cx"> 
</span><del>-                                        if ( $user_can ) {
-                                                // preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash
-                                                $actions = array(
-                                                        'approve' =&gt; '', 'unapprove' =&gt; '',
-                                                        'reply' =&gt; '',
-                                                        'quickedit' =&gt; '',
-                                                        'edit' =&gt; '',
-                                                        'spam' =&gt; '', 'unspam' =&gt; '',
-                                                        'trash' =&gt; '', 'untrash' =&gt; '', 'delete' =&gt; ''
-                                                );
</del><ins>+                        $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment );
</ins><span class="cx"> 
</span><del>-                                                if ( $comment_status &amp;&amp; 'all' != $comment_status ) { // not looking at all comments
-                                                        if ( 'approved' == $the_comment_status )
-                                                                $actions['unapprove'] = &quot;&lt;a href='$unapprove_url' class='delete:the-comment-list:comment-$comment-&gt;comment_ID:e7e7d3:action=dim-comment&amp;amp;new=unapproved vim-u vim-destructive' title='&quot; . esc_attr__( 'Unapprove this comment' ) . &quot;'&gt;&quot; . __( 'Unapprove' ) . '&lt;/a&gt;';
-                                                        else if ( 'unapproved' == $the_comment_status )
-                                                                $actions['approve'] = &quot;&lt;a href='$approve_url' class='delete:the-comment-list:comment-$comment-&gt;comment_ID:e7e7d3:action=dim-comment&amp;amp;new=approved vim-a vim-destructive' title='&quot; . esc_attr__( 'Approve this comment' ) . &quot;'&gt;&quot; . __( 'Approve' ) . '&lt;/a&gt;';
-                                                } else {
-                                                        $actions['approve'] = &quot;&lt;a href='$approve_url' class='dim:the-comment-list:comment-$comment-&gt;comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='&quot; . esc_attr__( 'Approve this comment' ) . &quot;'&gt;&quot; . __( 'Approve' ) . '&lt;/a&gt;';
-                                                        $actions['unapprove'] = &quot;&lt;a href='$unapprove_url' class='dim:the-comment-list:comment-$comment-&gt;comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='&quot; . esc_attr__( 'Unapprove this comment' ) . &quot;'&gt;&quot; . __( 'Unapprove' ) . '&lt;/a&gt;';
-                                                }
</del><ins>+                        $i = 0;
+                        echo '&lt;div class=&quot;row-actions&quot;&gt;';
+                        foreach ( $actions as $action =&gt; $link ) {
+                                ++$i;
+                                ( ( ( 'approve' == $action || 'unapprove' == $action ) &amp;&amp; 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
</ins><span class="cx"> 
</span><del>-                                                if ( 'spam' != $the_comment_status &amp;&amp; 'trash' != $the_comment_status ) {
-                                                        $actions['spam'] = &quot;&lt;a href='$spam_url' class='delete:the-comment-list:comment-$comment-&gt;comment_ID::spam=1 vim-s vim-destructive' title='&quot; . esc_attr__( 'Mark this comment as spam' ) . &quot;'&gt;&quot; . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '&lt;/a&gt;';
-                                                } elseif ( 'spam' == $the_comment_status ) {
-                                                        $actions['unspam'] = &quot;&lt;a href='$unspam_url' class='delete:the-comment-list:comment-$comment-&gt;comment_ID:66cc66:unspam=1 vim-z vim-destructive'&gt;&quot; . _x( 'Not Spam', 'comment' ) . '&lt;/a&gt;';
-                                                } elseif ( 'trash' == $the_comment_status ) {
-                                                        $actions['untrash'] = &quot;&lt;a href='$untrash_url' class='delete:the-comment-list:comment-$comment-&gt;comment_ID:66cc66:untrash=1 vim-z vim-destructive'&gt;&quot; . __( 'Restore' ) . '&lt;/a&gt;';
-                                                }
</del><ins>+                                // Reply and quickedit need a hide-if-no-js span when not added with ajax
+                                if ( ( 'reply' == $action || 'quickedit' == $action ) &amp;&amp; ! $this-&gt;from_ajax )
+                                        $action .= ' hide-if-no-js';
+                                elseif ( ( $action == 'untrash' &amp;&amp; $the_comment_status == 'trash' ) || ( $action == 'unspam' &amp;&amp; $the_comment_status == 'spam' ) ) {
+                                        if ( '1' == get_comment_meta( $comment_id, '_wp_trash_meta_status', true ) )
+                                                $action .= ' approve';
+                                        else
+                                                $action .= ' unapprove';
+                                }
</ins><span class="cx"> 
</span><del>-                                                if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) {
-                                                        $actions['delete'] = &quot;&lt;a href='$delete_url' class='delete:the-comment-list:comment-$comment-&gt;comment_ID::delete=1 delete vim-d vim-destructive'&gt;&quot; . __( 'Delete Permanently' ) . '&lt;/a&gt;';
-                                                } else {
-                                                        $actions['trash'] = &quot;&lt;a href='$trash_url' class='delete:the-comment-list:comment-$comment-&gt;comment_ID::trash=1 delete vim-d vim-destructive' title='&quot; . esc_attr__( 'Move this comment to the trash' ) . &quot;'&gt;&quot; . _x( 'Trash', 'verb' ) . '&lt;/a&gt;';
-                                                }
</del><ins>+                                echo &quot;&lt;span class='$action'&gt;$sep$link&lt;/span&gt;&quot;;
+                        }
+                        echo '&lt;/div&gt;';
+                }
+        }
</ins><span class="cx"> 
</span><del>-                                                if ( 'trash' != $the_comment_status ) {
-                                                        $actions['edit'] = &quot;&lt;a href='comment.php?action=editcomment&amp;amp;c={$comment-&gt;comment_ID}' title='&quot; . esc_attr__( 'Edit comment' ) . &quot;'&gt;&quot;. __( 'Edit' ) . '&lt;/a&gt;';
-                                                        $actions['quickedit'] = '&lt;a onclick=&quot;commentReply.open( \''.$comment-&gt;comment_ID.'\',\''.$post-&gt;ID.'\',\'edit\' );return false;&quot; class=&quot;vim-q&quot; title=&quot;'.esc_attr__( 'Quick Edit' ).'&quot; href=&quot;#&quot;&gt;' . __( 'Quick&amp;nbsp;Edit' ) . '&lt;/a&gt;';
-                                                        if ( 'spam' != $the_comment_status )
-                                                                $actions['reply'] = '&lt;a onclick=&quot;commentReply.open( \''.$comment-&gt;comment_ID.'\',\''.$post-&gt;ID.'\' );return false;&quot; class=&quot;vim-r&quot; title=&quot;'.esc_attr__( 'Reply to this comment' ).'&quot; href=&quot;#&quot;&gt;' . __( 'Reply' ) . '&lt;/a&gt;';
-                                                }
</del><ins>+        function column_author( $comment ) {
+                global $comment_status;
</ins><span class="cx"> 
</span><del>-                                                $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment );
</del><ins>+                $author_url = get_comment_author_url();
+                if ( 'http://' == $author_url )
+                        $author_url = '';
+                $author_url_display = preg_replace( '|http://(www\.)?|i', '', $author_url );
+                if ( strlen( $author_url_display ) &gt; 50 )
+                        $author_url_display = substr( $author_url_display, 0, 49 ) . '...';
</ins><span class="cx"> 
</span><del>-                                                $i = 0;
-                                                echo '&lt;div class=&quot;row-actions&quot;&gt;';
-                                                foreach ( $actions as $action =&gt; $link ) {
-                                                        ++$i;
-                                                        ( ( ( 'approve' == $action || 'unapprove' == $action ) &amp;&amp; 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
</del><ins>+                echo &quot;&lt;strong&gt;&quot;; comment_author(); echo '&lt;/strong&gt;&lt;br /&gt;';
+                if ( !empty( $author_url ) )
+                        echo &quot;&lt;a title='$author_url' href='$author_url'&gt;$author_url_display&lt;/a&gt;&lt;br /&gt;&quot;;
</ins><span class="cx"> 
</span><del>-                                                        // Reply and quickedit need a hide-if-no-js span when not added with ajax
-                                                        if ( ( 'reply' == $action || 'quickedit' == $action ) &amp;&amp; ! $from_ajax )
-                                                                $action .= ' hide-if-no-js';
-                                                        elseif ( ( $action == 'untrash' &amp;&amp; $the_comment_status == 'trash' ) || ( $action == 'unspam' &amp;&amp; $the_comment_status == 'spam' ) ) {
-                                                                if ( '1' == get_comment_meta( $comment_id, '_wp_trash_meta_status', true ) )
-                                                                        $action .= ' approve';
-                                                                else
-                                                                        $action .= ' unapprove';
-                                                        }
</del><ins>+                if ( $this-&gt;user_can ) {
+                        if ( !empty( $comment-&gt;comment_author_email ) ) {
+                                comment_author_email_link();
+                                echo '&lt;br /&gt;';
+                        }
+                        echo '&lt;a href=&quot;edit-comments.php?s=';
+                        comment_author_IP();
+                        echo '&amp;amp;mode=detail';
+                        if ( 'spam' == $comment_status )
+                                echo '&amp;amp;comment_status=spam';
+                        echo '&quot;&gt;';
+                        comment_author_IP();
+                        echo '&lt;/a&gt;';
+                }
+        }
</ins><span class="cx"> 
</span><del>-                                                        echo &quot;&lt;span class='$action'&gt;$sep$link&lt;/span&gt;&quot;;
-                                                }
-                                                echo '&lt;/div&gt;';
-                                        }
</del><ins>+        function column_date( $comment ) {
+                return get_comment_date( __( 'Y/m/d \a\t g:ia' ) );
+        }
</ins><span class="cx"> 
</span><del>-                                        echo '&lt;/td&gt;';
-                                        break;
-                                case 'author':
-                                        echo &quot;&lt;td $attributes&gt;&lt;strong&gt;&quot;; comment_author(); echo '&lt;/strong&gt;&lt;br /&gt;';
-                                        if ( !empty( $author_url ) )
-                                                echo &quot;&lt;a title='$author_url' href='$author_url'&gt;$author_url_display&lt;/a&gt;&lt;br /&gt;&quot;;
-                                        if ( $user_can ) {
-                                                if ( !empty( $comment-&gt;comment_author_email ) ) {
-                                                        comment_author_email_link();
-                                                        echo '&lt;br /&gt;';
-                                                }
-                                                echo '&lt;a href=&quot;edit-comments.php?s=';
-                                                comment_author_IP();
-                                                echo '&amp;amp;mode=detail';
-                                                if ( 'spam' == $comment_status )
-                                                        echo '&amp;amp;comment_status=spam';
-                                                echo '&quot;&gt;';
-                                                comment_author_IP();
-                                                echo '&lt;/a&gt;';
-                                        } //current_user_can
-                                        echo '&lt;/td&gt;';
-                                        break;
-                                case 'date':
-                                        echo &quot;&lt;td $attributes&gt;&quot; . get_comment_date( __( 'Y/m/d \a\t g:ia' ) ) . '&lt;/td&gt;';
-                                        break;
-                                case 'response':
-                                        if ( 'single' !== $mode ) {
-                                                if ( isset( $_comment_pending_count[$post-&gt;ID] ) ) {
-                                                        $pending_comments = $_comment_pending_count[$post-&gt;ID];
-                                                } else {
-                                                        $_comment_pending_count_temp = get_pending_comments_num( array( $post-&gt;ID ) );
-                                                        $pending_comments = $_comment_pending_count[$post-&gt;ID] = $_comment_pending_count_temp[$post-&gt;ID];
-                                                }
-                                                if ( $user_can ) {
-                                                        $post_link = &quot;&lt;a href='&quot; . get_edit_post_link( $post-&gt;ID ) . &quot;'&gt;&quot;;
-                                                        $post_link .= get_the_title( $post-&gt;ID ) . '&lt;/a&gt;';
-                                                } else {
-                                                        $post_link = get_the_title( $post-&gt;ID );
-                                                }
-                                                echo &quot;&lt;td $attributes&gt;\n&quot;;
-                                                echo '&lt;div class=&quot;response-links&quot;&gt;&lt;span class=&quot;post-com-count-wrapper&quot;&gt;';
-                                                echo $post_link . '&lt;br /&gt;';
-                                                $this-&gt;comments_bubble( $post-&gt;ID, $pending_comments );
-                                                echo '&lt;/span&gt; ';
-                                                echo &quot;&lt;a href='&quot; . get_permalink( $post-&gt;ID ) . &quot;'&gt;#&lt;/a&gt;&quot;;
-                                                echo '&lt;/div&gt;';
-                                                if ( 'attachment' == $post-&gt;post_type &amp;&amp; ( $thumb = wp_get_attachment_image( $post-&gt;ID, array( 80, 60 ), true ) ) )
-                                                        echo $thumb;
-                                                echo '&lt;/td&gt;';
-                                        }
-                                        break;
-                                default:
-                                        echo &quot;&lt;td $attributes&gt;\n&quot;;
-                                        do_action( 'manage_comments_custom_column', $column_name, $comment-&gt;comment_ID );
-                                        echo &quot;&lt;/td&gt;\n&quot;;
-                                        break;
-                        }
</del><ins>+        function column_response( $comment ) {
+                global $post;
+
+                if ( isset( $this-&gt;pending_count[$post-&gt;ID] ) ) {
+                        $pending_comments = $this-&gt;pending_count[$post-&gt;ID];
+                } else {
+                        $_pending_count_temp = get_pending_comments_num( array( $post-&gt;ID ) );
+                        $pending_comments = $this-&gt;pending_count[$post-&gt;ID] = $_pending_count_temp[$post-&gt;ID];
</ins><span class="cx">                 }
</span><del>-                echo &quot;&lt;/tr&gt;\n&quot;;
</del><ins>+
+                if ( current_user_can( 'edit_post', $post-&gt;ID ) ) {
+                        $post_link = &quot;&lt;a href='&quot; . get_edit_post_link( $post-&gt;ID ) . &quot;'&gt;&quot;;
+                        $post_link .= get_the_title( $post-&gt;ID ) . '&lt;/a&gt;';
+                } else {
+                        $post_link = get_the_title( $post-&gt;ID );
+                }
+
+                echo '&lt;div class=&quot;response-links&quot;&gt;&lt;span class=&quot;post-com-count-wrapper&quot;&gt;';
+                echo $post_link . '&lt;br /&gt;';
+                $this-&gt;comments_bubble( $post-&gt;ID, $pending_comments );
+                echo '&lt;/span&gt; ';
+                echo &quot;&lt;a href='&quot; . get_permalink( $post-&gt;ID ) . &quot;'&gt;#&lt;/a&gt;&quot;;
+                echo '&lt;/div&gt;';
+                if ( 'attachment' == $post-&gt;post_type &amp;&amp; ( $thumb = wp_get_attachment_image( $post-&gt;ID, array( 80, 60 ), true ) ) )
+                        echo $thumb;
</ins><span class="cx">         }
</span><ins>+
+        function column_default( $comment, $column_name ) {
+                do_action( 'manage_comments_custom_column', $column_name, $comment-&gt;comment_ID );
+        }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+class WP_Post_Comments_Table extends WP_Comments_Table {
+
+        function get_columns() {
+                return array(
+                        'author'   =&gt; __( 'Author' ),
+                        'comment'  =&gt; _x( 'Comment', 'column name' ),
+                );
+        }
+
+        function get_sortable_columns() {
+                return array();
+        }
+}
+
</ins><span class="cx"> class WP_Links_Table extends WP_List_Table {
</span><span class="cx"> 
</span><span class="cx">         function WP_Links_Table() {
</span></span></pre></div>
<a id="trunkwpadminincludesmetaboxesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/meta-boxes.php (15629 => 15630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/meta-boxes.php        2010-09-18 17:21:32 UTC (rev 15629)
+++ trunk/wp-admin/includes/meta-boxes.php        2010-09-18 17:46:29 UTC (rev 15630)
</span><span class="lines">@@ -459,10 +459,8 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
</span><del>-        add_filter('manage_edit-comments_columns', 'post_comment_meta_box_thead', 8, 1);
-        add_filter('manage_edit-comments_sortable_columns', '__return_empty_array', 8);
</del><span class="cx"> 
</span><del>-        $wp_list_table = get_list_table('comments');
</del><ins>+        $wp_list_table = get_list_table('post-comments');
</ins><span class="cx"> ?&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;table class=&quot;widefat comments-box fixed&quot; cellspacing=&quot;0&quot; style=&quot;display:none;&quot;&gt;
</span><span class="lines">@@ -478,7 +476,6 @@
</span><span class="cx">                 &lt;script type=&quot;text/javascript&quot;&gt;jQuery(document).ready(function(){commentsBox.get(&lt;?php echo $total; ?&gt;, 10);});&lt;/script&gt;
</span><span class="cx"> &lt;?php
</span><span class="cx">         }
</span><del>-        remove_filter('manage_edit-comments_columns', 'post_comment_meta_box_thead');
</del><span class="cx">         wp_comment_trashnotice();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>