Comments: Refresh the Moderate Comment screen for a friendlier experience with email moderation actions.

Brings some love to this neglected screen:
* format `comment_content`, instead of escaping in one massive block of text
* only wrap the comment date in a link if the comment permalink exists
* include link to the Edit Comment screen at the bottom of the comment_content
* update the message styles to match other screens
* append `#wpbody-content` to the comment email message links for accessibility

Props johnbillion, rachelbaker, afercia, melchoyce, karmatosed.

Fixes #34133
Built from https://develop.svn.wordpress.org/trunk@36588


git-svn-id: http://core.svn.wordpress.org/trunk@36555 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Rachel Baker 2016-02-19 19:14:26 +00:00
parent 30866ceb5d
commit 06225cc394
7 changed files with 46 additions and 28 deletions

View File

@ -81,7 +81,7 @@ case 'spam' :
$comment_id = absint( $_GET['c'] );
if ( !$comment = get_comment_to_edit( $comment_id ) ) {
if ( ! $comment = get_comment( $comment_id ) ) {
wp_redirect( admin_url('edit-comments.php?error=1') );
die();
}
@ -142,27 +142,27 @@ if ( $comment->comment_approved != '0' ) { // if not unapproved
break;
}
if ( $message ) {
echo '<div class="notice notice-info"><p>' . $message . '</p></div>';
echo '<div id="message" class="notice notice-info"><p>' . $message . '</p></div>';
}
}
?>
<p><strong><?php _e('Caution:'); ?></strong> <?php echo $caution_msg; ?></p>
<div id="message" class="notice notice-warning"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php echo $caution_msg; ?></p></div>
<table class="form-table comment-ays">
<tr>
<th scope="row"><?php _e('Author'); ?></th>
<td><?php echo $comment->comment_author; ?></td>
<td><?php comment_author( $comment ); ?></td>
</tr>
<?php if ( $comment->comment_author_email ) { ?>
<?php if ( get_comment_author_email( $comment ) ) { ?>
<tr>
<th scope="row"><?php _e('Email'); ?></th>
<td><?php echo $comment->comment_author_email; ?></td>
<td><?php comment_author_email( $comment ); ?></td>
</tr>
<?php } ?>
<?php if ( $comment->comment_author_url ) { ?>
<?php if ( get_comment_author_url( $comment ) ) { ?>
<tr>
<th scope="row"><?php _e('URL'); ?></th>
<td><a href="<?php echo $comment->comment_author_url; ?>"><?php echo $comment->comment_author_url; ?></a></td>
<td><a href="<?php comment_author_url( $comment ); ?>"><?php comment_author_url( $comment ); ?></a></td>
</tr>
<?php } ?>
<tr>
@ -194,19 +194,27 @@ if ( $comment->comment_approved != '0' ) { // if not unapproved
<tr>
<th scope="row"><?php _e( 'Submitted on' ); ?></th>
<td>
<a href="<?php echo esc_url( get_comment_link( $comment ) ); ?>"><?php
<?php
/* 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 )
);
?></a>
if ( 'approved' === wp_get_comment_status( $comment ) && ! empty ( $comment->comment_post_ID ) ) {
echo '<a href="' . esc_url( get_comment_link( $comment ) ) . '">' . $submitted . '</a>';
} else {
echo $submitted;
}
?>
</td>
</tr>
<tr>
<th scope="row"><?php /* translators: field name in comment form */ _ex('Comment', 'noun'); ?></th>
<td><?php echo $comment->comment_content; ?></td>
<td>
<?php echo $comment->comment_content; ?>
<p><a href="<?php echo admin_url( "comment.php?action=editcomment&amp;c={$comment->comment_ID}" ); ?>"><?php esc_attr_e( 'Edit' ); ?></a></p>
</td>
</tr>
</table>

View File

@ -1148,6 +1148,10 @@ p.popular-tags a {
padding: 10px 15px;
}
.comment-ays td p:last-of-type {
margin-top: 10px;
}
.comment-ays-submit .button-cancel {
margin-right: 1em;
}

File diff suppressed because one or more lines are too long

View File

@ -1148,6 +1148,10 @@ p.popular-tags a {
padding: 10px 15px;
}
.comment-ays td p:last-of-type {
margin-top: 10px;
}
.comment-ays-submit .button-cancel {
margin-left: 1em;
}

File diff suppressed because one or more lines are too long

View File

@ -1499,11 +1499,11 @@ function wp_notify_postauthor( $comment_id, $deprecated = null ) {
if ( user_can( $post->post_author, 'edit_comment', $comment->comment_ID ) ) {
if ( EMPTY_TRASH_DAYS ) {
$notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c={$comment->comment_ID}") ) . "\r\n";
$notify_message .= sprintf( __( 'Trash it: %s' ), admin_url( "comment.php?action=trash&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
} else {
$notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c={$comment->comment_ID}") ) . "\r\n";
$notify_message .= sprintf( __( 'Delete it: %s' ), admin_url( "comment.php?action=delete&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
}
$notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c={$comment->comment_ID}") ) . "\r\n";
$notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
}
$wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
@ -1640,16 +1640,18 @@ function wp_notify_moderator($comment_id) {
break;
}
$notify_message .= sprintf( __('Approve it: %s'), admin_url("comment.php?action=approve&c=$comment_id") ) . "\r\n";
$notify_message .= sprintf( __( 'Approve it: %s' ), admin_url( "comment.php?action=approve&c={$comment_id}#wpbody-content" ) ) . "\r\n";
if ( EMPTY_TRASH_DAYS )
$notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n";
$notify_message .= sprintf( __( 'Trash it: %s' ), admin_url( "comment.php?action=trash&c={$comment_id}#wpbody-content" ) ) . "\r\n";
else
$notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n";
$notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n";
$notify_message .= sprintf( __( 'Delete it: %s' ), admin_url( "comment.php?action=delete&c={$comment_id}#wpbody-content" ) ) . "\r\n";
$notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c={$comment_id}#wpbody-content" ) ) . "\r\n";
$notify_message .= sprintf( _n('Currently %s comment is waiting for approval. Please visit the moderation panel:',
'Currently %s comments are waiting for approval. Please visit the moderation panel:', $comments_waiting), number_format_i18n($comments_waiting) ) . "\r\n";
$notify_message .= admin_url("edit-comments.php?comment_status=moderated") . "\r\n";
$notify_message .= admin_url( "edit-comments.php?comment_status=moderated#wpbody-content" ) . "\r\n";
$subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), $blogname, $post->post_title );
$message_headers = '';

View File

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