WordPress.org

Make WordPress Core

Changeset 36588


Ignore:
Timestamp:
02/19/2016 07:13:59 PM (2 years ago)
Author:
rachelbaker
Message:

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

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/comment.php

    r36173 r36588  
    8282    $comment_id = absint( $_GET['c'] );
    8383
    84     if ( !$comment = get_comment_to_edit( $comment_id ) ) {
     84    if ( ! $comment = get_comment( $comment_id ) ) {
    8585        wp_redirect( admin_url('edit-comments.php?error=1') );
    8686        die();
     
    143143    }
    144144    if ( $message ) {
    145         echo '<div class="notice notice-info"><p>' . $message . '</p></div>';
     145        echo '<div id="message" class="notice notice-info"><p>' . $message . '</p></div>';
    146146    }
    147147}
    148148?>
    149 <p><strong><?php _e('Caution:'); ?></strong> <?php echo $caution_msg; ?></p>
     149<div id="message" class="notice notice-warning"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php echo $caution_msg; ?></p></div>
    150150
    151151<table class="form-table comment-ays">
    152152<tr>
    153153<th scope="row"><?php _e('Author'); ?></th>
    154 <td><?php echo $comment->comment_author; ?></td>
    155 </tr>
    156 <?php if ( $comment->comment_author_email ) { ?>
     154<td><?php comment_author( $comment ); ?></td>
     155</tr>
     156<?php if ( get_comment_author_email( $comment ) ) { ?>
    157157<tr>
    158158<th scope="row"><?php _e('Email'); ?></th>
    159 <td><?php echo $comment->comment_author_email; ?></td>
     159<td><?php comment_author_email( $comment ); ?></td>
    160160</tr>
    161161<?php } ?>
    162 <?php if ( $comment->comment_author_url ) { ?>
     162<?php if ( get_comment_author_url( $comment ) ) { ?>
    163163<tr>
    164164<th scope="row"><?php _e('URL'); ?></th>
    165 <td><a href="<?php echo $comment->comment_author_url; ?>"><?php echo $comment->comment_author_url; ?></a></td>
     165<td><a href="<?php comment_author_url( $comment ); ?>"><?php comment_author_url( $comment ); ?></a></td>
    166166</tr>
    167167<?php } ?>
     
    195195    <th scope="row"><?php _e( 'Submitted on' ); ?></th>
    196196    <td>
    197         <a href="<?php echo esc_url( get_comment_link( $comment ) ); ?>"><?php
    198             /* translators: 1: comment date, 2: comment time */
    199             printf( __( '%1$s at %2$s' ),
    200                 /* translators: comment date format. See http://php.net/date */
    201                 get_comment_date( __( 'Y/m/d' ), $comment ),
    202                 get_comment_date( __( 'g:i a' ), $comment )
    203             );
    204         ?></a>
     197    <?php
     198        /* translators: 1: comment date, 2: comment time */
     199        $submitted = sprintf( __( '%1$s at %2$s' ),
     200            /* translators: comment date format. See http://php.net/date */
     201            get_comment_date( __( 'Y/m/d' ), $comment ),
     202            get_comment_date( __( 'g:i a' ), $comment )
     203        );
     204        if ( 'approved' === wp_get_comment_status( $comment ) && ! empty ( $comment->comment_post_ID ) ) {
     205            echo '<a href="' . esc_url( get_comment_link( $comment ) ) . '">' . $submitted . '</a>';
     206        } else {
     207            echo $submitted;
     208        }
     209    ?>
    205210    </td>
    206211</tr>
    207212<tr>
    208213<th scope="row"><?php /* translators: field name in comment form */ _ex('Comment', 'noun'); ?></th>
    209 <td><?php echo $comment->comment_content; ?></td>
     214<td>
     215    <?php echo $comment->comment_content; ?>
     216    <p><a href="<?php echo admin_url( "comment.php?action=editcomment&amp;c={$comment->comment_ID}" ); ?>"><?php esc_attr_e( 'Edit' ); ?></a></p>
     217</td>
    210218</tr>
    211219</table>
  • trunk/src/wp-admin/css/edit.css

    r36537 r36588  
    11471147.comment-ays td {
    11481148    padding: 10px 15px;
     1149}
     1150
     1151.comment-ays td p:last-of-type {
     1152    margin-top: 10px;
    11491153}
    11501154
  • trunk/src/wp-includes/pluggable.php

    r36446 r36588  
    15001500    if ( user_can( $post->post_author, 'edit_comment', $comment->comment_ID ) ) {
    15011501        if ( EMPTY_TRASH_DAYS ) {
    1502             $notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c={$comment->comment_ID}") ) . "\r\n";
     1502            $notify_message .= sprintf( __( 'Trash it: %s' ), admin_url( "comment.php?action=trash&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
    15031503        } else {
    1504             $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c={$comment->comment_ID}") ) . "\r\n";
     1504            $notify_message .= sprintf( __( 'Delete it: %s' ), admin_url( "comment.php?action=delete&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
    15051505        }
    1506         $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c={$comment->comment_ID}") ) . "\r\n";
     1506        $notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
    15071507    }
    15081508
     
    16411641    }
    16421642
    1643     $notify_message .= sprintf( __('Approve it: %s'),  admin_url("comment.php?action=approve&c=$comment_id") ) . "\r\n";
     1643    $notify_message .= sprintf( __( 'Approve it: %s' ), admin_url( "comment.php?action=approve&c={$comment_id}#wpbody-content" ) ) . "\r\n";
     1644
    16441645    if ( EMPTY_TRASH_DAYS )
    1645         $notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n";
     1646        $notify_message .= sprintf( __( 'Trash it: %s' ), admin_url( "comment.php?action=trash&c={$comment_id}#wpbody-content" ) ) . "\r\n";
    16461647    else
    1647         $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n";
    1648     $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n";
     1648        $notify_message .= sprintf( __( 'Delete it: %s' ), admin_url( "comment.php?action=delete&c={$comment_id}#wpbody-content" ) ) . "\r\n";
     1649
     1650    $notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c={$comment_id}#wpbody-content" ) ) . "\r\n";
    16491651
    16501652    $notify_message .= sprintf( _n('Currently %s comment is waiting for approval. Please visit the moderation panel:',
    16511653        'Currently %s comments are waiting for approval. Please visit the moderation panel:', $comments_waiting), number_format_i18n($comments_waiting) ) . "\r\n";
    1652     $notify_message .= admin_url("edit-comments.php?comment_status=moderated") . "\r\n";
     1654    $notify_message .= admin_url( "edit-comments.php?comment_status=moderated#wpbody-content" ) . "\r\n";
    16531655
    16541656    $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), $blogname, $post->post_title );
Note: See TracChangeset for help on using the changeset viewer.