Fix comment delete links and ajax moderation. Props mdawaffe. fixes #5288

git-svn-id: http://svn.automattic.com/wordpress/trunk@6298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-10-31 01:37:58 +00:00
parent bccb7897d7
commit 24f0b83cae
1 changed files with 22 additions and 8 deletions

View File

@ -147,7 +147,7 @@ $comments = array_slice( $comments, $start, $stop );
<form name="approval" id="approval" action="<?php echo basename( __FILE__ ); ?>" method="post"> <form name="approval" id="approval" action="<?php echo basename( __FILE__ ); ?>" method="post">
<?php wp_nonce_field( 'moderate-comments' ); ?> <?php wp_nonce_field( 'moderate-comments' ); ?>
<input type="hidden" name="action" value="update" /> <input type="hidden" name="action" value="update" />
<ol id="the-comments-list" class="commentlist"> <ol id="the-comment-list" class="list:comment commentlist">
<?php <?php
$i = 0; $i = 0;
@ -157,6 +157,11 @@ $comments = array_slice( $comments, $start, $stop );
if ( $i++ % 2 ) { if ( $i++ % 2 ) {
$class .= ' alternate'; $class .= ' alternate';
} }
$delete_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
$approve_url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) );
$spam_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
?> ?>
<li id="comment-<?php comment_ID(); ?>" class="<?php echo $class; ?>"> <li id="comment-<?php comment_ID(); ?>" class="<?php echo $class; ?>">
<p> <p>
@ -170,20 +175,29 @@ $comments = array_slice( $comments, $start, $stop );
<?php comment_text(); ?> <?php comment_text(); ?>
</p> </p>
<p><small> <p>
<?php comment_date( __( 'M j, g:i A' ) ); ?> &#8212; <?php comment_date( __( 'M j, g:i A' ) ); ?>
[ <a href="comment.php?action=editcomment&amp;c=<?php comment_ID(); ?>" title="<?php _e( 'Edit this comment' ); ?>"><?php _e( 'Edit' ); ?></a> | &#8212;
<a href="post.php?action=deletecomment&amp;p=<?php echo $comment->comment_post_ID; ?>" title="<?php _e( 'Delete this comment' ); ?>" onclick="return deleteSomething( 'comment', <?php comment_ID(); ?>, '<?php echo js_escape( sprintf( __( "You are about to delete this comment by '%s'.\n'OK' to delete, 'Cancel' to stop." ), get_comment_author() ) ); ?>', theCommentList );"><?php _e( 'Delete' ); ?></a> ] &#8212; [
<a href="comment.php?action=editcomment&amp;c=<?php comment_ID(); ?>" title="<?php _e( 'Edit this comment' ); ?>"><?php _e( 'Edit' ); ?></a>
|
<a href="<?php echo $delete_url; ?>" class="delete:the-comment-list:comment-<?php comment_ID(); ?>" title="<?php _e( 'Delete this comment' ); ?>"><?php _e( 'Delete' ); ?></a>
|
<a href="<?php echo $approve_url; ?>" class="delete:the-comment-list:comment-<?php comment_ID(); ?>:33FF33:action=dim-comment" title="<?php _e( 'Approve this comment' ); ?>"><?php _e( 'Approve' ); ?></a>
|
<a href="<?php echo $spam_url; ?>" class="delete:the-comment-list:comment-<?php comment_ID(); ?>::spam=1" title="<?php _e( 'Mark this comment as spam' ); ?>"><?php _e( 'Spam' ); ?></a>
]
&#8212;
<a href="<?php echo get_permalink( $comment->comment_post_ID ); ?>" title="<?php _e( 'View the post' ); ?>"><?php printf( __( 'View post &#8220;%s&#8221;' ), get_the_title( $comment->comment_post_ID ) ); ?></a> <a href="<?php echo get_permalink( $comment->comment_post_ID ); ?>" title="<?php _e( 'View the post' ); ?>"><?php printf( __( 'View post &#8220;%s&#8221;' ), get_the_title( $comment->comment_post_ID ) ); ?></a>
</small></p> </p>
<p><small> <p>
<?php _e( 'Bulk action:' ); ?> <?php _e( 'Bulk action:' ); ?>
<label for="comment-<?php comment_ID(); ?>-approve"><input type="radio" name="comment[<?php comment_ID(); ?>]" id="comment-<?php comment_ID(); ?>-approve" value="approve" /> <?php _e( 'Approve' ); ?></label> &nbsp; <label for="comment-<?php comment_ID(); ?>-approve"><input type="radio" name="comment[<?php comment_ID(); ?>]" id="comment-<?php comment_ID(); ?>-approve" value="approve" /> <?php _e( 'Approve' ); ?></label> &nbsp;
<label for="comment-<?php comment_ID(); ?>-spam"><input type="radio" name="comment[<?php comment_ID(); ?>]" id="comment-<?php comment_ID(); ?>-spam" value="spam" /> <?php _e( 'Spam' ); ?></label> &nbsp; <label for="comment-<?php comment_ID(); ?>-spam"><input type="radio" name="comment[<?php comment_ID(); ?>]" id="comment-<?php comment_ID(); ?>-spam" value="spam" /> <?php _e( 'Spam' ); ?></label> &nbsp;
<label for="comment-<?php comment_ID(); ?>-delete"><input type="radio" name="comment[<?php comment_ID(); ?>]" id="comment-<?php comment_ID(); ?>-delete" value="delete" /> <?php _e( 'Delete' ); ?></label> &nbsp; <label for="comment-<?php comment_ID(); ?>-delete"><input type="radio" name="comment[<?php comment_ID(); ?>]" id="comment-<?php comment_ID(); ?>-delete" value="delete" /> <?php _e( 'Delete' ); ?></label> &nbsp;
<label for="comment-<?php comment_ID(); ?>-nothing"><input type="radio" name="comment[<?php comment_ID(); ?>]" id="comment-<?php comment_ID(); ?>-nothing" value="later" checked="checked" /> <?php _e( 'No action' ); ?></label> <label for="comment-<?php comment_ID(); ?>-nothing"><input type="radio" name="comment[<?php comment_ID(); ?>]" id="comment-<?php comment_ID(); ?>-nothing" value="later" checked="checked" /> <?php _e( 'No action' ); ?></label>
</small></p> </p>
</li> </li>
<?php <?php
} }