[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
Mon Oct 10 13:58:53 UTC 2022


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

 * status:  reopened => closed
 * resolution:   => fixed


Comment:

 @manfcarlo After thinking about this, I think the merged code is OK for
 now.

 == Justification
 I think adding this will be great for //new// developers, even if long-
 time developers implemented their own `update_role` functionality.  I
 think this is one instance where core can lead the way and provide a
 needed method to reduce the burden on developers.  As you mention, this is
 mainly an alias with the `unset` work already being done.

 == Validation Checks
 A lot of the validation checks are just the way core does things.
 Countless functions in core accept a variety of input parameters then
 validate and convert them to a single type for processing inside the
 function.  Also, with the changes in PHP 8 type checking is all the more
 important.

 As it stands now, this will ship with 6.1.  If you would like to see
 specific improvements, please file a follow-up ticket.  If they are bugs,
 they can even be addressed in 6.1.1.

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


More information about the wp-trac mailing list