Add 'trash' in comment moderation emails, props nacin, fixes #11426

git-svn-id: http://svn.automattic.com/wordpress/trunk@12402 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-12-15 10:55:55 +00:00
parent 6769f5d7e8
commit acf271551d
9 changed files with 121 additions and 82 deletions

View File

@ -17,6 +17,18 @@ wp_reset_vars( array('action') );
if ( isset( $_POST['deletecomment'] ) )
$action = 'deletecomment';
if ( 'cdc' == $action )
$action = 'delete';
elseif ( 'mac' == $action )
$action = 'approve';
if ( isset( $_GET['dt'] ) ) {
if ( 'spam' == $_GET['dt'] )
$action = 'spam';
elseif ( 'trash' == $_GET['dt'] )
$action = 'trash';
}
/**
* Display error message at bottom of comments.
*
@ -53,62 +65,51 @@ case 'editcomment' :
break;
case 'cdc' :
case 'mac' :
case 'delete' :
case 'approve' :
case 'trash' :
case 'spam' :
require_once('admin-header.php');
$comment_id = absint( $_GET['c'] );
$formaction = 'cdc' == $action ? 'deletecomment' : 'approvecomment';
$nonce_action = 'cdc' == $action ? 'delete-comment_' : 'approve-comment_';
$formaction = $action . 'comment';
$nonce_action = 'approve' == $action ? 'approve-comment_' : 'delete-comment_';
$nonce_action .= $comment_id;
if ( !$comment = get_comment_to_edit( $comment_id ) )
comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php') );
if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
comment_footer_die( 'cdc' == $action ? __('You are not allowed to delete comments on this post.') : __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
comment_footer_die( 'approve' != $action ? __('You are not allowed to delete comments on this post.') : __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
?>
<div class='wrap'>
<div class="narrow">
<?php
if ( 'spam' == $_GET['dt'] ) {
$caution_msg = __('You are about to mark the following comment as spam:');
$button = __('Spam Comment');
} elseif ( 'cdc' == $action ) {
$caution_msg = __('You are about to delete the following comment:');
$button = __('Delete Comment');
} else {
$caution_msg = __('You are about to approve the following comment:');
$button = __('Approve Comment');
switch ( $action ) {
case 'spam' :
$caution_msg = __('You are about to mark the following comment as spam:');
$button = __('Spam Comment');
break;
case 'trash' :
$caution_msg = __('You are about to move the following comment to the Trash:');
$button = __('Trash Comment');
break;
case 'delete' :
$caution_msg = __('You are about to delete the following comment:');
$button = __('Permanently Delete Comment');
break;
default :
$caution_msg = __('You are about to approve the following comment:');
$button = __('Approve Comment');
break;
}
?>
<p><strong><?php _e('Caution:'); ?></strong> <?php echo $caution_msg; ?></p>
<p><?php _e('Are you sure you want to do that?'); ?></p>
<form action='comment.php' method='get'>
<table width="100%">
<tr>
<td><input type='button' class="button" value='<?php esc_attr_e('No'); ?>' onclick="self.location='<?php echo admin_url('edit-comments.php'); ?>'" /></td>
<td class="textright"><input type='submit' class="button" value='<?php echo esc_attr($button); ?>' /></td>
</tr>
</table>
<?php wp_nonce_field( $nonce_action ); ?>
<input type='hidden' name='action' value='<?php echo esc_attr($formaction); ?>' />
<?php if ( 'spam' == $_GET['dt'] ) { ?>
<input type='hidden' name='dt' value='spam' />
<?php } ?>
<input type='hidden' name='p' value='<?php echo esc_attr($comment->comment_post_ID); ?>' />
<input type='hidden' name='c' value='<?php echo esc_attr($comment->comment_ID); ?>' />
<input type='hidden' name='noredir' value='1' />
</form>
<table class="form-table" cellpadding="5">
<table class="form-table comment-ays">
<tr class="alt">
<th scope="row"><?php _e('Author'); ?></th>
<td><?php echo $comment->comment_author; ?></td>
@ -131,6 +132,24 @@ if ( 'spam' == $_GET['dt'] ) {
</tr>
</table>
<p><?php _e('Are you sure you want to do that?'); ?></p>
<form action='comment.php' method='get'>
<table width="100%">
<tr>
<td><a class="button" href="<?php echo admin_url('edit-comments.php'); ?>"><?php esc_attr_e('No'); ?></a></td>
<td class="textright"><input type='submit' class="button" value='<?php echo esc_attr($button); ?>' /></td>
</tr>
</table>
<?php wp_nonce_field( $nonce_action ); ?>
<input type='hidden' name='action' value='<?php echo esc_attr($formaction); ?>' />
<input type='hidden' name='p' value='<?php echo esc_attr($comment->comment_post_ID); ?>' />
<input type='hidden' name='c' value='<?php echo esc_attr($comment->comment_ID); ?>' />
<input type='hidden' name='noredir' value='1' />
</form>
</div>
</div>
<?php
@ -142,6 +161,8 @@ case 'untrashcomment' :
case 'spamcomment' :
case 'unspamcomment' :
$comment_id = absint( $_REQUEST['c'] );
check_admin_referer( 'delete-comment_' . $comment_id );
$noredir = isset($_REQUEST['noredir']);
if ( !$comment = get_comment($comment_id) )
@ -149,8 +170,6 @@ case 'unspamcomment' :
if ( !current_user_can('edit_post', $comment->comment_post_ID ) )
comment_footer_die( __('You are not allowed to edit comments on this post.') );
check_admin_referer( 'delete-comment_' . $comment_id );
if ( '' != wp_get_referer() && false == $noredir && false === strpos(wp_get_referer(), 'comment.php') )
$redir = wp_get_referer();
elseif ( '' != wp_get_original_referer() && false == $noredir )
@ -162,7 +181,7 @@ case 'unspamcomment' :
switch ( $action ) {
case 'deletecomment' :
wp_delete_comment($comment_id);
wp_delete_comment( $comment_id );
$redir = add_query_arg( array('deleted' => '1'), $redir );
break;
case 'trashcomment' :
@ -188,52 +207,37 @@ case 'unspamcomment' :
die;
break;
case 'approvecomment' :
case 'unapprovecomment' :
$comment_id = absint( $_GET['c'] );
check_admin_referer( 'approve-comment_' . $comment_id );
if ( isset( $_GET['noredir'] ) )
$noredir = true;
else
$noredir = false;
$noredir = isset( $_GET['noredir'] );
if ( !$comment = get_comment( $comment_id ) )
comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php') );
if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
comment_footer_die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') );
wp_set_comment_status( $comment->comment_ID, 'hold' );
if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) ) {
if ( 'approvecomment' == $action )
comment_footer_die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
else
comment_footer_die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') );
}
if ( '' != wp_get_referer() && false == $noredir )
wp_redirect( wp_get_referer() );
$redir = remove_query_arg( array('approved', 'unapproved'), wp_get_referer() );
else
wp_redirect( admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) . '#comments') );
$redir = admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) );
exit();
break;
if ( 'approvecomment' == $action ) {
wp_set_comment_status( $comment_id, 'approve' );
$redir = add_query_arg( array( 'approved' => 1 ), $redir );
} else {
wp_set_comment_status( $comment_id, 'hold' );
$redir = add_query_arg( array( 'unapproved' => 1 ), $redir );
}
case 'approvecomment' :
$comment_id = absint( $_GET['c'] );
check_admin_referer( 'approve-comment_' . $comment_id );
if ( isset( $_GET['noredir'] ) )
$noredir = true;
else
$noredir = false;
if ( !$comment = get_comment( $comment_id ) )
comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php') );
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
comment_footer_die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
wp_set_comment_status( $comment->comment_ID, 'approve' );
if ( '' != wp_get_referer() && false == $noredir )
wp_redirect( wp_get_referer() );
else
wp_redirect( admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) . '#comments') );
wp_redirect( $redir );
exit();
break;

File diff suppressed because one or more lines are too long

View File

@ -1697,3 +1697,12 @@ div.widgets-sortables,
#dashboard_recent_comments div.undo {
border-top-color: #dfdfdf;
}
.comment-ays,
.comment-ays th {
border-color: #ddd;
}
.comment-ays th {
background-color: #f1f1f1;
}

File diff suppressed because one or more lines are too long

View File

@ -1686,3 +1686,12 @@ div.widgets-sortables,
#dashboard_recent_comments div.undo {
border-top-color: #dfdfdf;
}
.comment-ays,
.comment-ays th {
border-color: #ddd;
}
.comment-ays th {
background-color: #f1f1f1;
}

File diff suppressed because one or more lines are too long

View File

@ -3623,3 +3623,14 @@ span.imgedit-scale-warn {
.describe .del-link {
padding-left: 5px;
}
.comment-ays {
margin-bottom: 0;
border-style: solid;
border-width: 1px;
}
.comment-ays th {
border-right-style: solid;
border-right-width: 1px;
}

View File

@ -1017,8 +1017,11 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
$subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title );
}
$notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
$notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=cdc&c=$comment_id") ) . "\r\n";
$notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=cdc&dt=spam&c=$comment_id") ) . "\r\n";
if ( EMPTY_TRASH_DAYS )
$notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n";
else
$notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n";
$notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n";
$wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
@ -1101,9 +1104,12 @@ function wp_notify_moderator($comment_id) {
break;
}
$notify_message .= sprintf( __('Approve it: %s'), admin_url("comment.php?action=mac&c=$comment_id") ) . "\r\n";
$notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=cdc&c=$comment_id") ) . "\r\n";
$notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=cdc&dt=spam&c=$comment_id") ) . "\r\n";
$notify_message .= sprintf( __('Approve it: %s'), admin_url("comment.php?action=approve&c=$comment_id") ) . "\r\n";
if ( EMPTY_TRASH_DAYS )
$notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n";
else
$notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n";
$notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n";
$notify_message .= sprintf( _n('Currently %s comment is waiting for approval. Please visit the moderation panel:',
'Currently %s comments are waiting for approval. Please visit the moderation panel:', $comments_waiting), number_format_i18n($comments_waiting) ) . "\r\n";

View File

@ -426,9 +426,9 @@ function wp_default_styles( &$styles ) {
$rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' );
// all colors stylesheets need to have the same query strings (cache manifest compat)
$colors_version = '20091210';
$colors_version = '20091214';
$styles->add( 'wp-admin', "/wp-admin/wp-admin$suffix.css", array(), '20091212' );
$styles->add( 'wp-admin', "/wp-admin/wp-admin$suffix.css", array(), '20091214' );
$styles->add_data( 'wp-admin', 'rtl', "/wp-admin/rtl$suffix.css" );
$styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20091128' );