From 257427865812a08b4fc08d0413827304fd0de59e Mon Sep 17 00:00:00 2001 From: audrasjb Date: Wed, 26 Feb 2025 23:50:23 +0000 Subject: [PATCH] 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 --- wp-admin/includes/class-wp-comments-list-table.php | 4 ++++ wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/class-wp-comments-list-table.php b/wp-admin/includes/class-wp-comments-list-table.php index e7707daba9..c4d323cf89 100644 --- a/wp-admin/includes/class-wp-comments-list-table.php +++ b/wp-admin/includes/class-wp-comments-list-table.php @@ -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 ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 8a988b6d67..4e8c754836 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.