Changeset 888
- Timestamp:
- 02/17/2004 10:50:33 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-comments.php
r887 r888 38 38 <p><a href="?mode=view">View Mode</a> | <a href="?mode=edit">Mass Edit Mode</a></p> 39 39 <?php 40 if (!empty($delete_comments)) { 41 42 // I had this all as one query but then realized we weren't checking permissions on each comment. 43 $del_comments = ''; $safe_delete_commeents = ''; $i = 0; 44 foreach ($delete_comments as $comment) { // Check the permissions on each 45 $comment = intval($comment); 46 $post_id = $wpdb->get_var("SELECT comment_post_ID FROM $tablecomments WHERE comment_ID = $comment"); 47 $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $tableposts WHERE ID = $post_id")); 48 if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { 49 $wpdb->query("DELETE FROM $tablecomments WHERE comment_ID = $comment"); 50 ++$i; 51 } 52 } 53 echo "<div class='wrap'><p>$i comments deleted.</p></div>"; 54 } 55 40 56 if ($s) { 41 57 $s = $wpdb->escape($s); … … 54 70 echo '<ol>'; 55 71 foreach ($comments as $comment) { 72 $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $tableposts WHERE ID = $comment->comment_post_ID")); 56 73 $comment_status = wp_get_comment_status($comment->comment_ID); 57 74 if ('unapproved' == $comment_status) { … … 87 104 } // end if ($comments) 88 105 } elseif ('edit' == $mode) { 106 89 107 if ($comments) { 90 108 echo '<form name="deletecomments" id="deletecomments" action="" method="post"> … … 96 114 <th scope="col">IP</th> 97 115 <th scope="col">Comment Excerpt</th> 116 <th scope="col">View</th> 98 117 <th scope="col">Edit</th> 99 118 <th scope="col">Delete</th> 100 119 </tr>'; 101 120 foreach ($comments as $comment) { 121 $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $tableposts WHERE ID = $comment->comment_post_ID")); 102 122 $bgcolor = ('#eee' == $bgcolor) ? 'none' : '#eee'; 103 123 ?> 104 124 <tr style='background-color: <?php echo $bgcolor; ?>'> 105 <td>< input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /></td>125 <td><?php if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td> 106 126 <th scope="row"><?php comment_author_link() ?></th> 107 127 <td><?php comment_author_email_link() ?></td> 108 128 <td><a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></td> 109 129 <td><?php comment_excerpt(); ?></td> 130 <td><a href="<?php echo get_permalink($comment->comment_post_ID); ?>#comment-<?php comment_ID() ?>" class="edit">View</a></td> 110 131 <td><?php if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { 111 132 echo "<a href='post.php?action=editcomment&comment=$comment->comment_ID' class='edit'>Edit</a>"; } ?></td> … … 121 142 <?php 122 143 } else { 123 124 ?> 125 <p> 126 <strong>No results found.</strong> 127 </p> 128 129 <?php 144 ?> 145 <p> 146 <strong>No results found.</strong> 147 </p> 148 <?php 130 149 } // end if ($comments) 131 150 }
Note: See TracChangeset
for help on using the changeset viewer.