[wp-trac] [WordPress Trac] #54572: Add a function for updating the existing role instead of removing, then adding one

WordPress Trac noreply at wordpress.org
Thu Apr 14 04:22:32 UTC 2022


#54572: Add a function for updating the existing role instead of removing, then
adding one
-------------------------------------------------+-------------------------
 Reporter:  maksimkuzmin                         |       Owner:  (none)
     Type:  enhancement                          |      Status:  reviewing
 Priority:  normal                               |   Milestone:  6.0
Component:  Role/Capability                      |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests needs-      |     Focuses:
  refresh                                        |  performance
-------------------------------------------------+-------------------------
Changes (by peterwilsoncc):

 * keywords:  has-patch has-unit-tests => has-patch has-unit-tests needs-
     refresh


Comment:

 In the [https://github.com/WordPress/wordpress-develop/pull/2585 linked
 pull request], I've added a little tidy up to [attachment:"54572.diff"] :

 * split unit tests to different types of update
 * added a test to ensure `user_can()` works as expected after a role
 update
 * modified the docblocks
 * matched the functions arguments to the methods arguments
 * left the `empty( $role )` check as is, it's used as an array key only so
 that should keep the values sensible

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54572#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list