Skip to content

Commit bbdd9fb

Browse files
committed
Comments: Remove bulk action dropdown depending on user caps.
This changeset adds a conditional to show the comments bulk actions dropdown only when the current user has `moderate_comments` capability. Props snicco, iflairwebtechnologies, shanemuir, audrasjb. Fixes #59440. git-svn-id: https://develop.svn.wordpress.org/trunk@59877 602fd350-edb4-49c9-b593-d223f7449a82
1 parent b607715 commit bbdd9fb

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/wp-admin/includes/class-wp-comments-list-table.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,10 @@ protected function get_views() {
357357
protected function get_bulk_actions() {
358358
global $comment_status;
359359

360+
if ( ! current_user_can( 'moderate_comments' ) ) {
361+
return array(); // Return an empty array if the user doesn't have permission
362+
}
363+
360364
$actions = array();
361365

362366
if ( in_array( $comment_status, array( 'all', 'approved' ), true ) ) {

0 commit comments

Comments
 (0)