diff --git a/wp-admin/comment.php b/wp-admin/comment.php
index cae90c5c5c..4f913e073b 100644
--- a/wp-admin/comment.php
+++ b/wp-admin/comment.php
@@ -35,6 +35,7 @@ if ( isset( $_GET['dt'] ) ) {
* @param string $msg Error Message. Assumed to contain HTML and be sanitized.
*/
function comment_footer_die( $msg ) {
+ global $hook_suffix;
echo "
+
+
+
+
comment_post_ID ) )
comment_footer_die( __('You are not allowed to edit comments on this post.') );
- if ( '' != wp_get_referer() && false == $noredir && false === strpos(wp_get_referer(), 'comment.php') )
+ if ( '' != wp_get_referer() && ! $noredir && false === strpos(wp_get_referer(), 'comment.php') )
$redir = wp_get_referer();
- elseif ( '' != wp_get_original_referer() && false == $noredir )
+ elseif ( '' != wp_get_original_referer() && ! $noredir )
$redir = wp_get_original_referer();
+ elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) )
+ $redir = admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) );
else
$redir = admin_url('edit-comments.php');
- $redir = remove_query_arg( array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids'), $redir );
+ $redir = remove_query_arg( array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids', 'approved', 'unapproved'), $redir );
switch ( $action ) {
case 'deletecomment' :
@@ -200,48 +219,20 @@ case 'unspamcomment' :
wp_unspam_comment($comment_id);
$redir = add_query_arg( array('unspammed' => '1'), $redir );
break;
- }
+ case 'approvecomment' :
+ wp_set_comment_status( $comment_id, 'approve' );
+ $redir = add_query_arg( array( 'approved' => 1 ), $redir );
+ break;
+ case 'unapprovecomment' :
+ wp_set_comment_status( $comment_id, 'hold' );
+ $redir = add_query_arg( array( 'unapproved' => 1 ), $redir );
+ break;
+ }
wp_redirect( $redir );
-
die;
break;
-case 'approvecomment' :
-case 'unapprovecomment' :
- $comment_id = absint( $_GET['c'] );
- check_admin_referer( 'approve-comment_' . $comment_id );
-
- $noredir = isset( $_GET['noredir'] );
-
- if ( !$comment = get_comment( $comment_id ) )
- comment_footer_die( __('Oops, no comment with this ID.') . sprintf('
'.__('Go back').'!', 'edit.php') );
-
- 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 )
- $redir = remove_query_arg( array('approved', 'unapproved'), wp_get_referer() );
- else
- $redir = admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) );
-
- 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 );
- }
-
- wp_redirect( $redir );
-
- exit();
- break;
-
case 'editedcomment' :
$comment_id = absint( $_POST['comment_ID'] );
diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php
index 19dd035d4b..cb952a4602 100644
--- a/wp-admin/edit-comments.php
+++ b/wp-admin/edit-comments.php
@@ -126,45 +126,53 @@ if ( isset($_GET['s']) && $_GET['s'] )
' . $error_msg . '
';
+}
+
if ( isset($_GET['approved']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) || isset($_GET['spammed']) || isset($_GET['unspammed']) ) {
- $approved = isset($_GET['approved']) ? (int) $_GET['approved'] : 0;
- $deleted = isset($_GET['deleted']) ? (int) $_GET['deleted'] : 0;
- $trashed = isset($_GET['trashed']) ? (int) $_GET['trashed'] : 0;
- $untrashed = isset($_GET['untrashed']) ? (int) $_GET['untrashed'] : 0;
- $spammed = isset($_GET['spammed']) ? (int) $_GET['spammed'] : 0;
- $unspammed = isset($_GET['unspammed']) ? (int) $_GET['unspammed'] : 0;
+ $approved = isset( $_GET['approved'] ) ? (int) $_GET['approved'] : 0;
+ $deleted = isset( $_GET['deleted'] ) ? (int) $_GET['deleted'] : 0;
+ $trashed = isset( $_GET['trashed'] ) ? (int) $_GET['trashed'] : 0;
+ $untrashed = isset( $_GET['untrashed'] ) ? (int) $_GET['untrashed'] : 0;
+ $spammed = isset( $_GET['spammed'] ) ? (int) $_GET['spammed'] : 0;
+ $unspammed = isset( $_GET['unspammed'] ) ? (int) $_GET['unspammed'] : 0;
if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 ) {
- echo '
';
+ if ( $approved > 0 )
+ $messages[] = sprintf( _n( '%s comment approved', '%s comments approved', $approved ), $approved );
- if ( $approved > 0 ) {
- printf( _n( '%s comment approved', '%s comments approved', $approved ), $approved );
- echo '
';
- }
if ( $spammed > 0 ) {
- printf( _n( '%s comment marked as spam.', '%s comments marked as spam.', $spammed ), $spammed );
$ids = isset($_GET['ids']) ? $_GET['ids'] : 0;
- echo ' ' . __('Undo') . '
';
- }
- if ( $unspammed > 0 ) {
- printf( _n( '%s comment restored from the spam', '%s comments restored from the spam', $unspammed ), $unspammed );
- echo '
';
- }
- if ( $trashed > 0 ) {
- printf( _n( '%s comment moved to the trash.', '%s comments moved to the trash.', $trashed ), $trashed );
- $ids = isset($_GET['ids']) ? $_GET['ids'] : 0;
- echo ' ' . __('Undo') . '
';
- }
- if ( $untrashed > 0 ) {
- printf( _n( '%s comment restored from the trash', '%s comments restored from the trash', $untrashed ), $untrashed );
- echo '
';
- }
- if ( $deleted > 0 ) {
- printf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted );
- echo '
';
+ $messages[] = sprintf( _n( '%s comment marked as spam.', '%s comments marked as spam.', $spammed ), $spammed ) . ' ' . __('Undo') . '
';
}
- echo '
';
+ if ( $unspammed > 0 )
+ $messages = sprintf( _n( '%s comment restored from the spam', '%s comments restored from the spam', $unspammed ), $unspammed );
+
+ if ( $trashed > 0 ) {
+ $ids = isset($_GET['ids']) ? $_GET['ids'] : 0;
+ $messages[] = sprintf( _n( '%s comment moved to the trash.', '%s comments moved to the trash.', $trashed ), $trashed ) . '
' . __('Undo') . '';
+ }
+
+ if ( $untrashed > 0 )
+ $messages[] = sprintf( _n( '%s comment restored from the trash', '%s comments restored from the trash', $untrashed ), $untrashed );
+
+ if ( $deleted > 0 )
+ $messages[] = sprintf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted );
+
+ echo '
' . implode( "
\n", $messages ) . '
';
}
}
?>