Create user_can, refactor current_user_can, author_can, current_user_can_for_blog
|Reported by:||simonwheatley||Owned by:|
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.
Change History (8)
- Component changed from Users to Role/Capability
- Milestone changed from Awaiting Review to 3.1