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.


Built from https://develop.svn.wordpress.org/trunk@59877


git-svn-id: http://core.svn.wordpress.org/trunk@59219 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2025-02-26 23:50:23 +00:00
parent b0efc2929c
commit 2574278658
2 changed files with 5 additions and 1 deletions

View File

@ -357,6 +357,10 @@ class WP_Comments_List_Table extends WP_List_Table {
protected function get_bulk_actions() {
global $comment_status;
if ( ! current_user_can( 'moderate_comments' ) ) {
return array(); // Return an empty array if the user doesn't have permission
}
$actions = array();
if ( in_array( $comment_status, array( 'all', 'approved' ), true ) ) {

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.8-alpha-59876';
$wp_version = '6.8-alpha-59877';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.