Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide bulk action dropdown base on user capability #8154

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/wp-admin/includes/class-wp-comments-list-table.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,11 @@
protected function get_bulk_actions() {
global $comment_status;

$actions = array();
if ( ! current_user_can( 'moderate_comments' ) ) {
return array(); // Return an empty array if the user doesn't have permission

Check failure on line 361 in src/wp-admin/includes/class-wp-comments-list-table.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Tabs must be used to indent lines; spaces are not allowed
}

Check failure on line 362 in src/wp-admin/includes/class-wp-comments-list-table.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Tabs must be used to indent lines; spaces are not allowed

$actions = array();

Check failure on line 364 in src/wp-admin/includes/class-wp-comments-list-table.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Tabs must be used to indent lines; spaces are not allowed
Comment on lines +360 to +364
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ( ! current_user_can( 'moderate_comments' ) ) {
return array(); // Return an empty array if the user doesn't have permission
}
$actions = array();
if ( ! current_user_can( 'moderate_comments' ) ) {
return array(); // Return an empty array if the user doesn't have permission
}
$actions = array();

Fix PHPCS issue


if ( in_array( $comment_status, array( 'all', 'approved' ), true ) ) {
$actions['unapprove'] = __( 'Unapprove' );
Expand Down
Loading