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

WordPress Trac noreply at wordpress.org
Thu Sep 26 16:19:33 UTC 2013


#22624: New current_user_has_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:  close            |
-----------------------------+------------------------------
Changes (by nacin):

 * keywords:   => close


Comment:

 I think we need to draw a line in the sand here.

  * Roles are merely a grouping of capabilities that can be assigned to a
 user. Only capabilities should be checked, not roles. If you need to know
 specifically what role a user has, there are a number of ways using the
 existing API.

  * A new function like this is ripe for abuse. We need people to check for
 capabilities, not roles, and having a current_user_has_role() function is
 just asking for them to do things wrong. We still haven't gotten people to
 stop checking for user levels, let's not go in this direction.

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


More information about the wp-trac mailing list