Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#38577 closed defect (bug) (fixed)

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

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

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 10 years ago.

Download all attachments as: .zip

Change History (5)

@jnylen0
10 years ago

#1 @jnylen0
10 years ago

  • Keywords has-patch needs-unit-tests added

#2 @jnylen0
10 years ago

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

#3 @pento
10 years ago

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

#4 @pento
10 years ago

  • Resolution → fixed
  • Status assigned → closed

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

Note: See TracTickets for help on using tickets.