Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#38577 closed defect (bug) (fixed)

REST API: Allow setting user role(s) as a comma-delimited string

Reported by: jnylen0's profile jnylen0 Owned by: pento's profile pento
Milestone: 4.7 Priority: normal
Severity: normal Version: 4.7
Component: REST API Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

When getting users, the roles property can be interpreted as a comma-delimited string. Similarly to #38553, we should also interpret roles this way when creating or editing a user.

This change also fixes 2 PHP warnings that occur when passing roles as a string:

PHP Warning:  Invalid argument supplied for foreach() in .../wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php on line 744
PHP Warning:  array_map(): Argument #2 should be an array in .../wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php on line 360

Attachments (1)

38577.diff (2.0 KB) - added by jnylen0 8 years ago.

Download all attachments as: .zip

Change History (5)

@jnylen0
8 years ago

#1 @jnylen0
8 years ago

  • Keywords has-patch needs-unit-tests added

#2 @jnylen0
8 years ago

  • Keywords has-unit-tests added; needs-unit-tests removed

#3 @pento
8 years ago

  • Milestone changed from Awaiting Review to 4.7
  • Owner set to pento
  • Status changed from new to assigned

#4 @pento
8 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in [39056], but I typoed the ticket number.

Note: See TracTickets for help on using tickets.