2 require_once('admin.php');
4 $title = __('Moderate comments');
5 $parent_file = 'edit.php';
8 $wpvarstoreset = array('action', 'item_ignored', 'item_deleted', 'item_approved', 'item_spam', 'feelinglucky');
9 for ($i=0; $i<count($wpvarstoreset); $i += 1) {
10 $wpvar = $wpvarstoreset[$i];
11 if (!isset($$wpvar)) {
12 if (empty($_POST["$wpvar"])) {
13 if (empty($_GET["$wpvar"])) {
16 $$wpvar = $_GET["$wpvar"];
19 $$wpvar = $_POST["$wpvar"];
25 if (isset($_POST["comment"])) {
26 foreach ($_POST["comment"] as $k => $v) {
27 $comment[intval($k)] = $v;
35 if ( ! current_user_can('moderate_comments') )
36 die('<p>'.__('Your level is not high enough to moderate comments.').'</p>');
43 foreach($comment as $key => $value) {
44 if ($feelinglucky && 'later' == $value)
48 // do nothing with that comment
49 // wp_set_comment_status($key, "hold");
53 wp_set_comment_status($key, 'delete');
57 wp_set_comment_status($key, 'spam');
61 wp_set_comment_status($key, 'approve');
62 if ( get_settings('comments_notify') == true ) {
63 wp_notify_postauthor($key);
70 $file = basename(__FILE__);
71 header("Location: $file?ignored=$item_ignored&deleted=$item_deleted&approved=$item_approved&spam=$item_spam");
78 require_once('admin-header.php');
80 if ( isset($_GET['deleted']) || isset($_GET['approved']) || isset($_GET['ignored']) ) {
81 echo "<div id='moderated' class='updated fade'>\n<p>";
82 $approved = (int) $_GET['approved'];
83 $deleted = (int) $_GET['deleted'];
84 $ignored = (int) $_GET['ignored'];
85 $spam = (int) $_GET['spam'];
87 if ('1' == $approved) {
88 echo __("1 comment approved") . " <br/>\n";
90 echo sprintf(__("%s comments approved <br />"), $approved) . "\n";
94 if ('1' == $deleted) {
95 echo __("1 comment deleted") . " <br/>\n";
97 echo sprintf(__("%s comments deleted"), $deleted) . " <br/>\n";
102 echo __("1 comment marked as spam") . " <br/>\n";
104 echo sprintf(__("%s comments marked as spam"), $spam) . " <br/>\n";
108 if ('1' == $ignored) {
109 echo __("1 comment unchanged") . " <br/>\n";
111 echo sprintf(__("%s comments unchanged"), $ignored) . " <br/>\n";
122 if ( current_user_can('moderate_comments') )
123 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '0'");
128 // list all comments that are waiting for approval
129 $file = basename(__FILE__);
131 <h2><?php _e('Moderation Queue') ?></h2>
132 <form name="approval" action="moderation.php" method="post">
133 <input type="hidden" name="action" value="update" />
134 <ol id="the-list" class="commentlist">
137 foreach($comments as $comment) {
139 $comment_date = mysql2date(get_settings("date_format") . " @ " . get_settings("time_format"), $comment->comment_date);
140 $post_title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID='$comment->comment_post_ID'");
141 if ($i % 2) $class = 'class="alternate"';
143 echo "\n\t<li id='comment-$comment->comment_ID' $class>";
145 <p><strong><?php _e('Name:') ?></strong> <?php comment_author_link() ?> <?php if ($comment->comment_author_email) { ?>| <strong><?php _e('E-mail:') ?></strong> <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <strong><?php _e('URI:') ?></strong> <?php comment_author_url_link() ?> <?php } ?>| <strong><?php _e('IP:') ?></strong> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a> | <strong><?php _e('Date:') ?></strong> <?php comment_date(); ?></p>
146 <?php comment_text() ?>
148 echo '<a href="post.php?action=editcomment&comment='.$comment->comment_ID.'">' . __('Edit') . '</a> | ';?>
149 <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php _e('View Post') ?></a> |
151 echo " <a href=\"post.php?action=deletecomment&p=".$comment->comment_post_ID."&comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . sprintf(__("You are about to delete this comment by "%s".\\n"Cancel" to stop, "OK" to delete."), wp_specialchars($comment->comment_author, 1)) . "' );\">" . __('Delete just this comment') . "</a> | "; ?> <?php _e('Bulk action:') ?>
152 <input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment[<?php echo $comment->comment_ID; ?>]-approve" value="approve" /> <label for="comment[<?php echo $comment->comment_ID; ?>]-approve"><?php _e('Approve') ?></label>
153 <input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment[<?php echo $comment->comment_ID; ?>]-spam" value="spam" /> <label for="comment[<?php echo $comment->comment_ID; ?>]-spam"><?php _e('Spam') ?></label>
154 <input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment[<?php echo $comment->comment_ID; ?>]-delete" value="delete" /> <label for="comment[<?php echo $comment->comment_ID; ?>]-delete"><?php _e('Delete') ?></label>
155 <input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment[<?php echo $comment->comment_ID; ?>]-nothing" value="later" checked="checked" /> <label for="comment[<?php echo $comment->comment_ID; ?>]-nothing"><?php _e('Defer until later') ?></label>
164 <div id="ajax-response"></div>
166 <p class="submit"><input type="submit" name="submit" value="<?php _e('Moderate Comments »') ?>" /></p>
167 <script type="text/javascript">
169 function markAllForDelete() {
170 for (var i=0; i< document.approval.length; i++) {
171 if (document.approval[i].value == "delete") {
172 document.approval[i].checked = true;
176 function markAllForApprove() {
177 for (var i=0; i< document.approval.length; i++) {
178 if (document.approval[i].value == "approve") {
179 document.approval[i].checked = true;
183 function markAllForDefer() {
184 for (var i=0; i< document.approval.length; i++) {
185 if (document.approval[i].value == "later") {
186 document.approval[i].checked = true;
190 function markAllAsSpam() {
191 for (var i=0; i< document.approval.length; i++) {
192 if (document.approval[i].value == "spam") {
193 document.approval[i].checked = true;
197 document.write('<ul><li><a href="javascript:markAllForApprove()"><?php _e('Mark all for approval'); ?></a></li><li><a href="javascript:markAllAsSpam()"><?php _e('Mark all as spam'); ?></a></li><li><a href="javascript:markAllForDelete()"><?php _e('Mark all for deletion'); ?></a></li><li><a href="javascript:markAllForDefer()"><?php _e('Mark all for later'); ?></a></li></ul>');
203 <input name="feelinglucky" type="checkbox" id="feelinglucky" value="true" /> <label for="feelinglucky"><?php _e('Delete every comment marked "defer." <strong>Warning: This can’t be undone.</strong>'); ?></label>
209 // nothing to approve
210 echo '<p>'.__("Currently there are no comments for you to moderate.") . "</p>\n";
222 include('admin-footer.php') ?>