WordPress.org

Make WordPress Core

Changeset 13247


Ignore:
Timestamp:
02/20/2010 11:48:38 AM (8 years ago)
Author:
nacin
Message:

Show awareness of comment's current status when moderating via e-mail/AYS. Show message on AYS screen of comment's status if not unapproved. Skip AYS when trying to re-approve (or delete or spam) a comment and show a message. See #11441

Location:
trunk/wp-admin
Files:
2 edited

Legend:

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

    r13246 r13247  
    8484    }
    8585
     86    // No need to re-approve/re-trash/re-spam a comment.
     87    if ( $action == str_replace( '1', 'approve', $comment->comment_approved ) ) {
     88        wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) );
     89        die();
     90    }
     91
    8692    require_once('admin-header.php');
    8793
     
    117123        break;
    118124}
     125
     126if ( $comment->comment_approved != '0' ) { // if not unapproved
     127    $message = '';
     128    switch ( $comment->comment_approved ) {
     129        case '1' :
     130            $message = __('This comment is currently approved.');
     131            break;
     132        case 'spam' :
     133            $message  = __('This comment is currently marked as spam.');
     134            break;
     135        case 'trash' :
     136            $message  = __('This comment is currently in the Trash.');
     137            break;
     138    }
     139    if ( $message )
     140        echo '<div class="updated"><p>' . $message . '</p></div>';
     141}
    119142?>
    120 
    121143<p><strong><?php _e('Caution:'); ?></strong> <?php echo $caution_msg; ?></p>
    122144
  • trunk/wp-admin/edit-comments.php

    r13246 r13247  
    142142}
    143143
    144 if ( isset($_GET['approved']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) || isset($_GET['spammed']) || isset($_GET['unspammed']) ) {
     144if ( isset($_GET['approved']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) || isset($_GET['spammed']) || isset($_GET['unspammed']) || isset($_GET['same']) ) {
    145145    $approved  = isset( $_GET['approved']  ) ? (int) $_GET['approved']  : 0;
    146146    $deleted   = isset( $_GET['deleted']   ) ? (int) $_GET['deleted']   : 0;
     
    149149    $spammed   = isset( $_GET['spammed']   ) ? (int) $_GET['spammed']   : 0;
    150150    $unspammed = isset( $_GET['unspammed'] ) ? (int) $_GET['unspammed'] : 0;
    151 
    152     if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 ) {
     151    $same      = isset( $_GET['same'] )      ? (int) $_GET['same']      : 0;
     152
     153    if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0 ) {
    153154        if ( $approved > 0 )
    154155            $messages[] = sprintf( _n( '%s comment approved', '%s comments approved', $approved ), $approved );
     
    172173        if ( $deleted > 0 )
    173174            $messages[] = sprintf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted );
     175
     176        if ( $same > 0 && $comment = get_comment( $same ) ) {
     177            switch ( $comment->comment_approved ) {
     178                case '1' :
     179                    $messages[] = __('This comment is already approved.') . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>';
     180                    break;
     181                case 'trash' :
     182                    $messages[] = __( 'This comment is already in the Trash.' ) . ' <a href="' . esc_url( admin_url( 'edit-comments.php?comment_status=trash' ) ) . '"> ' . __( 'View Trash' ) . '</a>';
     183                    break;
     184                case 'spam' :
     185                    $messages[] = __( 'This comment is already marked as spam.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>';
     186                    break;
     187            }
     188        }
    174189
    175190        echo '<div id="moderated" class="updated"><p>' . implode( "<br/>\n", $messages ) . '</p></div>';
Note: See TracChangeset for help on using the changeset viewer.