[wp-hackers] What does user_can really check?

Tom Barrett tcbarrett at gmail.com
Thu Nov 24 06:19:00 UTC 2011


On 23 November 2011 23:46, Dion Hulse (dd32) <wordpress at dd32.id.au> wrote:

> It responding to the role name is just a legacy thing, something that
> can't be removed - because people use it unfortunately, same as the
> user_levels, that should've gone a long time ago.. but I still correct
> examples people put into the codex that use it..


Checking user role is useful. For example, to style the back end with a
nice colour coding. It might be nice to have explicit has_cap() and
user_role_is() strict functions, but I'd rather that core settled on users
having only having one role before moving on to that. I think that is part
of the reason why developers use current_user_can() to check for role(s).

-- 
http://www.tcbarrett.com | http://gplus.to/tcbarrett |
http://twitter.com/tcbarrett


More information about the wp-hackers mailing list