[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
Tue Sep 27 02:46:18 UTC 2022


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

Comment (by manfcarlo):

 Replying to [comment:25 davidbaumwald]:
 > @manfcarlo Thanks for the feedback.  I think we can do some more
 hardening as you suggest.  Would you like to upload a patch for the
 `isset` checks?

 I think that would be sensible if the method had already been released.
 Since it's been committed but not released yet, I would rather suggest
 that the whole method be reverted and removed.

 The method that was committed basically consists of a few public variables
 being unset and an existing method being called, preceded by a series of
 defensive validation checks that would not be needed if the plugin author
 knows what role they want to update and how.

 Even if an update method is deemed justified, I think the validation
 checks are overkill and it should be easy enough for the plugin author to
 supply the correct arguments. Besides, supplying `null` as the display
 name looks very odd and does not clearly communicate an intent to leave it
 unchanged.

 For something that is so easily achieved without an addition to core, the
 method and particularly the defensive validation just add disproportionate
 overhead for core contributors. The method was missing for more than a
 decade and no one said anything, and we now know that any feature that
 does not directly deal with blocks is destined to be a legacy feature. I
 am surprised the suggestion made it this far with so little objection.

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


More information about the wp-trac mailing list