[wp-trac] [WordPress Trac] #52076: Checking anonymous user's exist capability returns inconsistent results across functions.

WordPress Trac noreply at wordpress.org
Wed Feb 17 11:43:08 UTC 2021


#52076: Checking anonymous user's exist capability returns inconsistent results
across functions.
-------------------------------------------------+-------------------------
 Reporter:  peterwilsoncc                        |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  5.8
Component:  Role/Capability                      |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  early has-patch needs-unit-tests     |     Focuses:
  needs-dev-note                                 |
-------------------------------------------------+-------------------------

Comment (by SergeyBiryukov):

 At a glance, having similar functions with minor differences
 (`get_user_object()` vs. `get_userdata()`, `get_user_object_by()` vs.
 `get_user_by()`) doesn't seem ideal.

 I don't mind new functions when they have a clear purpose, but just to fix
 the `'exist'` inconsistency they seem a bit like an overkill :) They might
 make `user_can()` clearer in this case, but my concern is that there might
 be confusion later on when to use the newer ones vs. the older ones.

 Perhaps we could instantiate an anonymous user object within `user_can()`
 instead?

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


More information about the wp-trac mailing list