WordPress.org

Make WordPress Core

Opened 11 months ago

Closed 11 months ago

Last modified 11 months ago

#48725 closed defect (bug) (fixed)

Additional Capabilities list displayed in user-edit broke after 5.3 update

Reported by: aravindajith Owned by: SergeyBiryukov
Milestone: 5.3.1 Priority: normal
Severity: normal Version: 5.3
Component: Users Keywords: has-patch has-screenshots
Focuses: ui, administration Cc:

Description

Found a strange bug. List of Additional Capabilities in the user-edit page is replaced with '1,1,1,1' after WordPress 5.3 update.

Screenshot: https://www.dropbox.com/s/61sb1t81vgwpdsz/image_2019_11_19T12_55_24_093Z.png?raw=1

Steps to reproduce

  1. Edit any user with additional capabilities (user-edit.php)
  2. Scroll down to 'Additional Capabilities' section

Attachments (4)

image_2019_11_19T12_55_24_093Z.png (38.5 KB) - added by aravindajith 11 months ago.
Screenshot
48725.diff (416 bytes) - added by wpgurudev 11 months ago.
Capability display fix
fix.48725.diff (408 bytes) - added by anantajitjg 11 months ago.
This patch should fix the issue
48725-resolved.png (14.4 KB) - added by davidbaumwald 11 months ago.
Bug fixed with patch

Download all attachments as: .zip

Change History (10)

#1 @wpgurudev
11 months ago

Could you please list more detailed steps to reproduce the issue?

@wpgurudev
11 months ago

Capability display fix

#2 @wpgurudev
11 months ago

It is happening because value (boolean flag for capability) is being ouputted instead of capability.

Added patch.

#3 @wpgurudev
11 months ago

Steps to reproduce the issue.

  1. Login to site
  1. Add this code to functions.php of theme.
<?php
/**
 * Assign additional capabilities.
 *
 */
function custom_cap_48725() {

        $user = new WP_User( get_current_user_id() );
        $user->add_cap( 'can_create_plugins' );
        $user->add_cap( 'can_create_themes' );
}
add_action( 'init', 'custom_cap_48725' );
  1. Go to Users > Your profile, check Additional Capabilities section. You will see 1, 1

@anantajitjg
11 months ago

This patch should fix the issue

#4 @davidbaumwald
11 months ago

  • Focuses ui administration added
  • Keywords has-patch has-screenshots added
  • Milestone changed from Awaiting Review to 5.3.1
  • Severity changed from critical to normal

Great find @aravindajith! It appears this was introduced in [45926].

I've checked the patch, and it does resolve the issue. See the latest screenshot. I'm going to move this to the 5.3.1 milestone hoping it gets picked up.

@davidbaumwald
11 months ago

Bug fixed with patch

#5 @SergeyBiryukov
11 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 46782:

Users: Use correct variable when displaying the Additional Capabilities list in user profile.

Addresses a regression in [45926].

Props wpgurudev, aravindajith, anantajitjg, davidbaumwald.
Fixes #48725.

#6 @SergeyBiryukov
11 months ago

In 46783:

Users: Use correct variable when displaying the Additional Capabilities list in user profile.

Addresses a regression in [45926].

Props wpgurudev, aravindajith, anantajitjg, davidbaumwald.
Merges [46782] to the 5.3 branch.
Fixes #48725.

Note: See TracTickets for help on using tickets.