-
-
Save jimihenrik/afe9fbea88133442e530 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Disallow comment moderation | |
function block_bulk_comments_actions($actions) { | |
unset($actions['unapprove']); | |
unset($actions['approve']); | |
unset($actions['spam']); | |
unset($actions['trash']); | |
return $actions; | |
} | |
function block_comment_row_actions($actions, $comment) { | |
unset($actions['reply']); | |
unset($actions['approve']); | |
unset($actions['unapprove']); | |
if($comment->user_id != get_current_user_id()) { | |
unset($actions['quickedit']); | |
unset($actions['edit']); | |
unset($actions['trash']); | |
} | |
unset($actions['spam']); | |
return $actions; | |
} | |
if (!current_user_can('moderate_comments')) { | |
add_filter('bulk_actions-edit-comments', 'block_bulk_comments_actions'); | |
add_filter('comment_row_actions', 'block_comment_row_actions', 10, 2); | |
} | |
function UM_no_comment_moderation() { | |
global $pagenow; | |
if (!current_user_can('moderate_comments') && $pagenow == 'comment.php') { | |
if(get_current_user_id() != get_comment($_GET['c'])->user_id) { | |
wp_redirect(home_url().'/wp-admin/edit-comments.php'); exit; | |
} | |
} | |
} | |
add_action('admin_init', 'no_comment_moderation'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment