Make WordPress Core

Ticket #59440: 59440.patch

File 59440.patch, 776 bytes (added by iflairwebtechnologies, 14 months ago)

We have hide bulk action dropdown base on user capability

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

    diff --git a/src/wp-admin/includes/class-wp-comments-list-table.php b/src/wp-admin/includes/class-wp-comments-list-table.php
    old mode 100644
    new mode 100755
    index e7707daba9..5debb51225
    a b class WP_Comments_List_Table extends WP_List_Table { 
    357357        protected function get_bulk_actions() {
    358358                global $comment_status;
    359359
    360                 $actions = array();
     360                if ( ! current_user_can( 'moderate_comments' ) ) {
     361                return array(); // Return an empty array if the user doesn't have permission
     362            }
     363
     364            $actions = array();
    361365
    362366                if ( in_array( $comment_status, array( 'all', 'approved' ), true ) ) {
    363367                        $actions['unapprove'] = __( 'Unapprove' );