Changeset 6999
- Timestamp:
- 02/24/2008 02:33:30 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/edit-comments.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-comments.php
r6994 r6999 7 7 wp_enqueue_script('admin-forms'); 8 8 9 if ( !empty( $_ POST['delete_comments'] ) ) :9 if ( !empty( $_REQUEST['delete_comments'] ) ) : 10 10 check_admin_referer('bulk-comments'); 11 11 12 $ i = 0;13 foreach ($_ POST['delete_comments'] as $comment) : // Check the permissions on each12 $comments_deleted = $comments_approved = $comments_spammed = 0; 13 foreach ($_REQUEST['delete_comments'] as $comment) : // Check the permissions on each 14 14 $comment = (int) $comment; 15 15 $post_id = (int) $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment"); 16 16 // $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") ); 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++; 23 28 } 24 29 endforeach; 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 ); 35 31 endif; 36 32 … … 67 63 ?> 68 64 </ul> 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 ?> 69 94 70 95 <p id="post-search">
Note: See TracChangeset
for help on using the changeset viewer.