[wp-cvs] wordpress/wp-admin edit-comments.php,1.39,1.40
Ernest MacDougal Campbell III
emc3 at users.sourceforge.net
Tue Nov 23 15:09:26 UTC 2004
Update of /cvsroot/cafelog/wordpress/wp-admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8388/wp-admin
Modified Files:
edit-comments.php
Log Message:
Use new user_can_foo() functions, clean up comment editing
Index: edit-comments.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/edit-comments.php,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** edit-comments.php 19 Oct 2004 03:03:03 -0000 1.39
--- edit-comments.php 23 Nov 2004 15:09:24 -0000 1.40
***************
*** 44,48 ****
$post_id = $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment");
$authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") );
! if ( ($user_level > $authordata->user_level) || ($user_login == $authordata->user_login) ) :
$wpdb->query("DELETE FROM $wpdb->comments WHERE comment_ID = $comment");
++$i;
--- 44,48 ----
$post_id = $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment");
$authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") );
! if ( user_can_delete_post_comments($user_ID, $post_id) ) :
$wpdb->query("DELETE FROM $wpdb->comments WHERE comment_ID = $comment");
++$i;
***************
*** 92,104 ****
<?php comment_text() ?>
! <p><?php _e('Posted'); echo ' '; comment_date('M j, g:i A'); ?> | <?php
! if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) {
! echo "<a href=\"post.php?action=editcomment&comment=".$comment->comment_ID."\">" . __('Edit Comment') . "</a>";
echo " | <a href=\"post.php?action=deletecomment&p=".$comment->comment_post_ID."&comment=".$comment->comment_ID."\" onclick=\"return confirm('" . sprintf(__("You are about to delete this comment by \'%s\'\\n \'Cancel\' to stop, \'OK\' to delete."), $comment->comment_author) . "')\">" . __('Delete Comment') . "</a> — ";
} // end if any comments to show
// Get post title
! $post_title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID = $comment->comment_post_ID");
! $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
! ?> <a href="post.php?action=edit&post=<?php echo $comment->comment_post_ID; ?>"><?php printf(__('Edit Post “%s”'), stripslashes($post_title)); ?></a> | <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php _e('View Post') ?></a></p>
</li>
--- 92,109 ----
<?php comment_text() ?>
! <p><?php _e('Posted'); echo ' '; comment_date('M j, g:i A');
! if ( user_can_edit_post_comments($user_ID, $comment->comment_post_ID) ) {
! echo " | <a href=\"post.php?action=editcomment&comment=".$comment->comment_ID."\">" . __('Edit Comment') . "</a>";
! }
! if ( user_can_delete_post_comments($user_ID, $comment->comment_post_ID) ) {
echo " | <a href=\"post.php?action=deletecomment&p=".$comment->comment_post_ID."&comment=".$comment->comment_ID."\" onclick=\"return confirm('" . sprintf(__("You are about to delete this comment by \'%s\'\\n \'Cancel\' to stop, \'OK\' to delete."), $comment->comment_author) . "')\">" . __('Delete Comment') . "</a> — ";
} // end if any comments to show
// Get post title
! if ( user_can_edit_post($user_ID, $comment->comment_post_ID) ) {
! $post_title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID = $comment->comment_post_ID");
! $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
! ?> <a href="post.php?action=edit&post=<?php echo $comment->comment_post_ID; ?>"><?php printf(__('Edit Post “%s”'), stripslashes($post_title)); ?></a>
! <?php } ?>
! | <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php _e('View Post') ?></a></p>
</li>
***************
*** 139,143 ****
?>
<tr class='<?php echo $class; ?>'>
! <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>
<td><?php comment_author_link() ?></td>
<td><?php comment_author_email_link() ?></td>
--- 144,148 ----
?>
<tr class='<?php echo $class; ?>'>
! <td><?php if (user_can_delete_post_comments($user_ID, $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td>
<td><?php comment_author_link() ?></td>
<td><?php comment_author_email_link() ?></td>
***************
*** 145,151 ****
<td><?php comment_excerpt(); ?></td>
<td><a href="<?php echo get_permalink($comment->comment_post_ID); ?>#comment-<?php comment_ID() ?>" class="edit"><?php _e('View') ?></a></td>
! <td><?php if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) {
echo "<a href='post.php?action=editcomment&comment=$comment->comment_ID' class='edit'>" . __('Edit') . "</a>"; } ?></td>
! <td><?php if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) {
echo "<a href=\"post.php?action=deletecomment&p=".$comment->comment_post_ID."&comment=".$comment->comment_ID."\" onclick=\"return confirm('" . sprintf(__("You are about to delete this comment by \'%s\'\\n \'Cancel\' to stop, \'OK\' to delete."), $comment->comment_author) . "')\" class='delete'>" . __('Delete') . "</a>"; } ?></td>
</tr>
--- 150,156 ----
<td><?php comment_excerpt(); ?></td>
<td><a href="<?php echo get_permalink($comment->comment_post_ID); ?>#comment-<?php comment_ID() ?>" class="edit"><?php _e('View') ?></a></td>
! <td><?php if ( user_can_edit_post_comments($user_ID, $comment->comment_post_ID) ) {
echo "<a href='post.php?action=editcomment&comment=$comment->comment_ID' class='edit'>" . __('Edit') . "</a>"; } ?></td>
! <td><?php if ( user_can_delete_post_comments($user_ID, $comment->comment_post_ID) ) {
echo "<a href=\"post.php?action=deletecomment&p=".$comment->comment_post_ID."&comment=".$comment->comment_ID."\" onclick=\"return confirm('" . sprintf(__("You are about to delete this comment by \'%s\'\\n \'Cancel\' to stop, \'OK\' to delete."), $comment->comment_author) . "')\" class='delete'>" . __('Delete') . "</a>"; } ?></td>
</tr>
More information about the cvs
mailing list