[wp-trac] [WordPress Trac] #53131: Disjunctive normal form for WP_User::has_cap

WordPress Trac noreply at wordpress.org
Sun May 2 23:49:12 UTC 2021


#53131: Disjunctive normal form for WP_User::has_cap
-----------------------------+------------------------------
 Reporter:  manfcarlo        |       Owner:  (none)
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Users            |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------------------

Comment (by peterwilsoncc):

 @manfcarlo Thanks for the suggestion.

 I'm interested to know how this would be an improvement on something like:

 {{{#!php
 <?php
 if ( current_user_can( 'permission_one' ) || current_user_can(
 'permission_two' ) {
    do_something();
 }
 }}}

 I worry that including the `OR` relationship in the native
 `WP_Core::has_cap()` check could lead to developer confusion so both a
 strong use case and significant benefit would be needed for such a change.
 Are you able to expand on each?

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


More information about the wp-trac mailing list