Comments: add date column to WP_Comments_List_Table to allow sorting and to break out the date/time from the comment content column.

Props jshreve.
Fixes #15520.

Built from https://develop.svn.wordpress.org/trunk@34504


git-svn-id: http://core.svn.wordpress.org/trunk@34468 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-09-24 17:27:26 +00:00
parent 595bad9f37
commit bc5eb3a623
7 changed files with 28 additions and 20 deletions

View File

@ -386,6 +386,10 @@ table.media .column-title .filename {
width: 20%;
}
#comments-form .fixed .column-date {
width: 14%;
}
#commentsdiv.postbox .inside {
margin: 0;
padding: 0;

View File

@ -386,6 +386,10 @@ table.media .column-title .filename {
width: 20%;
}
#comments-form .fixed .column-date {
width: 14%;
}
#commentsdiv.postbox .inside {
margin: 0;
padding: 0;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -151,8 +151,9 @@ get_current_screen()->add_help_tab( array(
'content' =>
'<p>' . __( 'A red bar on the left means the comment is waiting for you to moderate it.' ) . '</p>' .
'<p>' . __( 'In the <strong>Author</strong> column, in addition to the author&#8217;s name, email address, and blog URL, the commenter&#8217;s IP address is shown. Clicking on this link will show you all the comments made from this IP address.' ) . '</p>' .
'<p>' . __( 'In the <strong>Comment</strong> column, above each comment it says &#8220;Submitted on,&#8221; followed by the date and time the comment was left on your site. Clicking on the date/time link will take you to that comment on your live site. Hovering over any comment gives you options to approve, reply (and approve), quick edit, edit, spam mark, or trash that comment.' ) . '</p>' .
'<p>' . __( 'In the <strong>Comment</strong> column, hovering over any comment gives you options to approve, reply (and approve), quick edit, edit, spam mark, or trash that comment.' ) . '</p>' .
'<p>' . __( 'In the <strong>In Response To</strong> column, there are three elements. The text is the name of the post that inspired the comment, and links to the post editor for that entry. The View Post link leads to that post on your live site. The small bubble with the number in it shows the number of approved comments that post has received. If there are pending comments, a red notification circle with the number of pending comments is displayed. Clicking the notification circle will filter the comments screen to show only pending comments on that post.' ) . '</p>' .
'<p>' . __( 'In the <strong>Submitted On</strong> column, the date and time the comment was left on your site appears. Clicking on the date/time link will take you to that comment on your live site.' ) . '</p>' .
'<p>' . __( 'Many people take advantage of keyboard shortcuts to moderate their comments more quickly. Use the link to the side to learn more.' ) . '</p>'
) );

View File

@ -399,6 +399,8 @@ class WP_Comments_List_Table extends WP_List_Table {
$columns['response'] = __( 'In Response To' );
}
$columns['date'] = _x( 'Submitted On', 'column name' );
return $columns;
}
@ -409,7 +411,8 @@ class WP_Comments_List_Table extends WP_List_Table {
protected function get_sortable_columns() {
return array(
'author' => 'comment_author',
'response' => 'comment_post_ID'
'response' => 'comment_post_ID',
'date' => 'comment_date'
);
}
@ -621,20 +624,10 @@ class WP_Comments_List_Table extends WP_List_Table {
* @param object $comment
*/
public function column_comment( $comment ) {
$comment_url = esc_url( get_comment_link( $comment ) );
echo '<div class="comment-author">';
$this->column_author( $comment );
echo '</div>';
echo '<div class="submitted-on">';
/* translators: 2: comment date, 3: comment time */
printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), $comment_url,
/* translators: comment date format. See http://php.net/date */
get_comment_date( __( 'Y/m/d' ), $comment ),
get_comment_date( get_option( 'time_format' ), $comment )
);
if ( $comment->comment_parent ) {
$parent = get_comment( $comment->comment_parent );
if ( $parent ) {
@ -642,13 +635,12 @@ class WP_Comments_List_Table extends WP_List_Table {
$name = get_comment_author( $parent );
printf(
/* translators: %s: comment link */
' | ' . __( 'In reply to %s.' ),
__( 'In reply to %s.' ),
'<a href="' . $parent_link . '">' . $name . '</a>'
);
}
}
echo '</div>';
comment_text( $comment );
if ( $this->user_can ) { ?>
<div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
@ -708,11 +700,18 @@ class WP_Comments_List_Table extends WP_List_Table {
}
/**
*
* @return string
* @access public
*/
public function column_date( $comment ) {
return get_comment_date( __( 'Y/m/d \a\t g:i a' ), $comment );
$comment_url = esc_url( get_comment_link( $comment ) );
echo '<div class="submitted-on">';
/* translators: 2: comment date, 3: comment time */
printf( __( '<a href="%1$s">%2$s at %3$s</a>' ), $comment_url,
/* translators: comment date format. See http://php.net/date */
get_comment_date( __( 'Y/m/d' ), $comment ),
get_comment_date( get_option( 'time_format' ), $comment )
);
echo '</div>';
}
/**

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34503';
$wp_version = '4.4-alpha-34504';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.