[wp-trac] [WordPress Trac] #22624: New current_user_role function to work for roles like current_user_can does for caps

WordPress Trac noreply at wordpress.org
Wed Nov 28 22:58:56 UTC 2012


#22624: New current_user_role function to work for roles like current_user_can does
for caps
-----------------------------+------------------------------
 Reporter:  sc0ttkclark      |       Owner:
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Users            |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |
-----------------------------+------------------------------

Comment (by SergeyBiryukov):

 `current_user_can( 'editor' )` also works.

 According to PHPDocs, the parameter is either a capability or a role name:
 [[BR]]
 http://core.trac.wordpress.org/browser/tags/3.4.2/wp-
 includes/capabilities.php#L1194

 However, there's some inconsistency (also mentioned in #20824).

 On single site, `current_user_can( 'editor' )` returns false for
 administrator, only `current_user_can( 'administrator' )` returns true.

 On Multisite, `current_user_can( 'editor' )` returns true for super admin.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22624#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list