[wp-trac] [WordPress Trac] #14602: Create user_can, refactor current_user_can, author_can, current_user_can_for_blog
WordPress Trac
wp-trac at lists.automattic.com
Thu Aug 12 18:13:00 UTC 2010
#14602: Create user_can, refactor current_user_can, author_can,
current_user_can_for_blog
---------------------------+------------------------------------------------
Reporter: simonwheatley | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version: 3.0.1
Severity: normal | Keywords: has-patch needs-testing
---------------------------+------------------------------------------------
Currently we have no function to pass a user ID and a capability/rolewhich
will return whether the user can perform that role or has that capability.
Further, the functions {{{current_user_can}}}, {{{author_can}}}, and
{{{current_user_can_for_blog}}} have some code duplication.
I suggest adding a new function {{{user_can}}}, which accepts any user_ID
or a user object and a capability, and returns a boolean. The other
{{{*_can*}}} functions can then be refactored to use the new function.
See attached patch.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14602>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list