diff --git a/wp-admin/comment.php b/wp-admin/comment.php index 4f913e073..31c9de60d 100644 --- a/wp-admin/comment.php +++ b/wp-admin/comment.php @@ -83,6 +83,12 @@ case 'spam' : die(); } + // No need to re-approve/re-trash/re-spam a comment. + if ( $action == str_replace( '1', 'approve', $comment->comment_approved ) ) { + wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) ); + die(); + } + require_once('admin-header.php'); $formaction = $action . 'comment'; @@ -116,8 +122,24 @@ switch ( $action ) { $button = __('Approve Comment'); break; } -?> +if ( $comment->comment_approved != '0' ) { // if not unapproved + $message = ''; + switch ( $comment->comment_approved ) { + case '1' : + $message = __('This comment is currently approved.'); + break; + case 'spam' : + $message = __('This comment is currently marked as spam.'); + break; + case 'trash' : + $message = __('This comment is currently in the Trash.'); + break; + } + if ( $message ) + echo '

' . $message . '

'; +} +?>

diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index cb952a460..a3c6e2bc3 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -141,15 +141,16 @@ if ( isset( $_GET['error'] ) ) { echo '

' . $error_msg . '

'; } -if ( isset($_GET['approved']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) || isset($_GET['spammed']) || isset($_GET['unspammed']) ) { +if ( isset($_GET['approved']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) || isset($_GET['spammed']) || isset($_GET['unspammed']) || isset($_GET['same']) ) { $approved = isset( $_GET['approved'] ) ? (int) $_GET['approved'] : 0; $deleted = isset( $_GET['deleted'] ) ? (int) $_GET['deleted'] : 0; $trashed = isset( $_GET['trashed'] ) ? (int) $_GET['trashed'] : 0; $untrashed = isset( $_GET['untrashed'] ) ? (int) $_GET['untrashed'] : 0; $spammed = isset( $_GET['spammed'] ) ? (int) $_GET['spammed'] : 0; $unspammed = isset( $_GET['unspammed'] ) ? (int) $_GET['unspammed'] : 0; + $same = isset( $_GET['same'] ) ? (int) $_GET['same'] : 0; - if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 ) { + if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0 ) { if ( $approved > 0 ) $messages[] = sprintf( _n( '%s comment approved', '%s comments approved', $approved ), $approved ); @@ -172,6 +173,20 @@ if ( isset($_GET['approved']) || isset($_GET['deleted']) || isset($_GET['trashed if ( $deleted > 0 ) $messages[] = sprintf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted ); + if ( $same > 0 && $comment = get_comment( $same ) ) { + switch ( $comment->comment_approved ) { + case '1' : + $messages[] = __('This comment is already approved.') . ' ' . __( 'Edit comment' ) . ''; + break; + case 'trash' : + $messages[] = __( 'This comment is already in the Trash.' ) . ' ' . __( 'View Trash' ) . ''; + break; + case 'spam' : + $messages[] = __( 'This comment is already marked as spam.' ) . ' ' . __( 'Edit comment' ) . ''; + break; + } + } + echo '

' . implode( "
\n", $messages ) . '

'; } }