<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[13247] trunk/wp-admin: Show awareness of comment'
s current status when moderating via e-mail/AYS.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13247">13247</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-02-20 11:48:38 +0000 (Sat, 20 Feb 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>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 <a href="http://trac.wordpress.org/ticket/11441">#11441</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmincommentphp">trunk/wp-admin/comment.php</a></li>
<li><a href="#trunkwpadmineditcommentsphp">trunk/wp-admin/edit-comments.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincommentphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/comment.php (13246 => 13247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/comment.php        2010-02-20 11:18:25 UTC (rev 13246)
+++ trunk/wp-admin/comment.php        2010-02-20 11:48:38 UTC (rev 13247)
</span><span class="lines">@@ -83,6 +83,12 @@
</span><span class="cx">                 die();
</span><span class="cx">         }
</span><span class="cx">
</span><ins>+        // 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();
+         }
+
</ins><span class="cx">         require_once('admin-header.php');
</span><span class="cx">
</span><span class="cx">         $formaction = $action . 'comment';
</span><span class="lines">@@ -116,8 +122,24 @@
</span><span class="cx">                 $button = __('Approve Comment');
</span><span class="cx">                 break;
</span><span class="cx"> }
</span><ins>+
+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 '<div class="updated"><p>' . $message . '</p></div>';
+}
</ins><span class="cx"> ?>
</span><del>-
</del><span class="cx"> <p><strong><?php _e('Caution:'); ?></strong> <?php echo $caution_msg; ?></p>
</span><span class="cx">
</span><span class="cx"> <table class="form-table comment-ays">
</span></span></pre></div>
<a id="trunkwpadmineditcommentsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-comments.php (13246 => 13247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-comments.php        2010-02-20 11:18:25 UTC (rev 13246)
+++ trunk/wp-admin/edit-comments.php        2010-02-20 11:48:38 UTC (rev 13247)
</span><span class="lines">@@ -141,15 +141,16 @@
</span><span class="cx">                 echo '<div id="moderated" class="error"><p>' . $error_msg . '</p></div>';
</span><span class="cx"> }
</span><span class="cx">
</span><del>-if ( isset($_GET['approved']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) || isset($_GET['spammed']) || isset($_GET['unspammed']) ) {
</del><ins>+if ( isset($_GET['approved']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) || isset($_GET['spammed']) || isset($_GET['unspammed']) || isset($_GET['same']) ) {
</ins><span class="cx">         $approved = isset( $_GET['approved'] ) ? (int) $_GET['approved'] : 0;
</span><span class="cx">         $deleted = isset( $_GET['deleted'] ) ? (int) $_GET['deleted'] : 0;
</span><span class="cx">         $trashed = isset( $_GET['trashed'] ) ? (int) $_GET['trashed'] : 0;
</span><span class="cx">         $untrashed = isset( $_GET['untrashed'] ) ? (int) $_GET['untrashed'] : 0;
</span><span class="cx">         $spammed = isset( $_GET['spammed'] ) ? (int) $_GET['spammed'] : 0;
</span><span class="cx">         $unspammed = isset( $_GET['unspammed'] ) ? (int) $_GET['unspammed'] : 0;
</span><ins>+        $same = isset( $_GET['same'] ) ? (int) $_GET['same'] : 0;
</ins><span class="cx">
</span><del>-        if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 ) {
</del><ins>+        if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0 ) {
</ins><span class="cx">                 if ( $approved > 0 )
</span><span class="cx">                         $messages[] = sprintf( _n( '%s comment approved', '%s comments approved', $approved ), $approved );
</span><span class="cx">
</span><span class="lines">@@ -172,6 +173,20 @@
</span><span class="cx">                 if ( $deleted > 0 )
</span><span class="cx">                         $messages[] = sprintf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted );
</span><span class="cx">
</span><ins>+                if ( $same > 0 && $comment = get_comment( $same ) ) {
+                        switch ( $comment->comment_approved ) {
+                                case '1' :
+                                        $messages[] = __('This comment is already approved.') . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>';
+                                        break;
+                                case 'trash' :
+                                        $messages[] = __( 'This comment is already in the Trash.' ) . ' <a href="' . esc_url( admin_url( 'edit-comments.php?comment_status=trash' ) ) . '"> ' . __( 'View Trash' ) . '</a>';
+                                        break;
+                                case 'spam' :
+                                        $messages[] = __( 'This comment is already marked as spam.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>';
+                                        break;
+                        }
+                }
+
</ins><span class="cx">                 echo '<div id="moderated" class="updated"><p>' . implode( "<br/>\n", $messages ) . '</p></div>';
</span><span class="cx">         }
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>