| 17 | | if ( current_user_can('edit_post', $post_id) ) { |
|---|
| 18 | | if ( !empty( $_POST['spam_button'] ) ) |
|---|
| 19 | | wp_set_comment_status($comment, 'spam'); |
|---|
| 20 | | else |
|---|
| 21 | | wp_set_comment_status($comment, 'delete'); |
|---|
| 22 | | ++$i; |
|---|
| | 17 | if ( !current_user_can('edit_post', $post_id) ) |
|---|
| | 18 | continue; |
|---|
| | 19 | if ( !empty( $_REQUEST['spamit'] ) ) { |
|---|
| | 20 | wp_set_comment_status($comment, 'spam'); |
|---|
| | 21 | $comments_spammed++; |
|---|
| | 22 | } elseif ( !empty( $_REQUEST['deleteit'] ) ) { |
|---|
| | 23 | wp_set_comment_status($comment, 'delete'); |
|---|
| | 24 | $comments_deleted++; |
|---|
| | 25 | } elseif ( !empty( $_REQUEST['approveit'] ) ) { |
|---|
| | 26 | wp_set_comment_status($comment, 'approve'); |
|---|
| | 27 | $comments_approved++; |
|---|
| 25 | | /* |
|---|
| 26 | | echo '<div style="background-color: rgb(207, 235, 247);" id="message" class="updated fade"><p>'; |
|---|
| 27 | | if ( !empty( $_POST['spam_button'] ) ) { |
|---|
| 28 | | printf(__ngettext('%s comment marked as spam.', '%s comments marked as spam.', $i), $i); |
|---|
| 29 | | } else { |
|---|
| 30 | | printf(__ngettext('%s comment deleted.', '%s comments deleted.', $i), $i); |
|---|
| 31 | | } |
|---|
| 32 | | echo '</p></div>'; |
|---|
| 33 | | */ |
|---|
| 34 | | // TODO redirect with message |
|---|
| | 30 | wp_redirect( basename( __FILE__ ) . '?deleted=' . $comments_deleted . '&approved=' . $comments_approved . '&spam=' . $comments_spammed ); |
|---|
| | 65 | |
|---|
| | 66 | <?php |
|---|
| | 67 | if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['spam'] ) ) { |
|---|
| | 68 | $approved = isset( $_GET['approved'] ) ? (int) $_GET['approved'] : 0; |
|---|
| | 69 | $deleted = isset( $_GET['deleted'] ) ? (int) $_GET['deleted'] : 0; |
|---|
| | 70 | $spam = isset( $_GET['spam'] ) ? (int) $_GET['spam'] : 0; |
|---|
| | 71 | |
|---|
| | 72 | if ( $approved > 0 || $deleted > 0 || $spam > 0 ) { |
|---|
| | 73 | echo '<div id="moderated" class="updated fade"><p>'; |
|---|
| | 74 | |
|---|
| | 75 | if ( $approved > 0 ) { |
|---|
| | 76 | printf( __ngettext( '%s comment approved', '%s comments approved', $approved ), $approved ); |
|---|
| | 77 | echo '<br />'; |
|---|
| | 78 | } |
|---|
| | 79 | |
|---|
| | 80 | if ( $deleted > 0 ) { |
|---|
| | 81 | printf( __ngettext( '%s comment deleted', '%s comments deleted', $deleted ), $deleted ); |
|---|
| | 82 | echo '<br />'; |
|---|
| | 83 | } |
|---|
| | 84 | |
|---|
| | 85 | if ( $spam > 0 ) { |
|---|
| | 86 | printf( __ngettext( '%s comment marked as spam', '%s comments marked as spam', $spam ), $spam ); |
|---|
| | 87 | echo '<br />'; |
|---|
| | 88 | } |
|---|
| | 89 | |
|---|
| | 90 | echo '</p></div>'; |
|---|
| | 91 | } |
|---|
| | 92 | } |
|---|
| | 93 | ?> |
|---|