Comments: In the comments list table, only link rows inside the “Submitted On” column to the comment if it is publicly viewable.

The date within the comments list table “Submitted On” column will only be wrapped in `get_comment_link()` if the comment is approved and associated with a valid `comment_post_ID`.

Fixes #35279.
Built from https://develop.svn.wordpress.org/trunk@36521


git-svn-id: http://core.svn.wordpress.org/trunk@36488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Rachel Baker 2016-02-12 21:43:26 +00:00
parent f846e08f2c
commit f99ec3db18
2 changed files with 13 additions and 5 deletions

View File

@ -716,15 +716,23 @@ class WP_Comments_List_Table extends WP_List_Table {
* @param WP_Comment $comment The comment object.
*/
public function column_date( $comment ) {
echo '<div class="submitted-on">';
echo '<a href="' . esc_url( get_comment_link( $comment ) ) . '">';
/* translators: 1: comment date, 2: comment time */
printf( __( '%1$s at %2$s' ),
$submitted = sprintf( __( '%1$s at %2$s' ),
/* translators: comment date format. See http://php.net/date */
get_comment_date( __( 'Y/m/d' ), $comment ),
get_comment_date( __( 'g:i a' ), $comment )
);
echo '</a>';
echo '<div class="submitted-on">';
if ( 'approved' === wp_get_comment_status( $comment ) && ! empty ( $comment->comment_post_ID ) ) {
printf(
'<a href="%s">%s</a>',
esc_url( get_comment_link( $comment ) ),
$submitted
);
} else {
echo $submitted;
}
echo '</div>';
}

View File

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