Opened 2 years ago
Last modified 5 months ago
#15819 new enhancement
Create user_can_for_blog function
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Role/Capability | Version: | 3.1 |
| Severity: | normal | Keywords: | has-patch needs-testing |
| Cc: |
Description
To compliment #14602, a user_can_for_blog function is needed.
Currently we have no function to pass a user ID, blog, and a capability/role which will return whether the user can perform that role or has that capability for a particular blog.
See attached patch please.
Thanks,
Mike
Attachments (2)
Change History (6)
comment:1
markjaquith — 2 years ago
- Milestone changed from Awaiting Review to Future Release
Updated patch for user_can_for_blog to deal with non-multisite properly, etc.
Added a newer version, would be great to see this in a release soon :). The version I added deals with non-multisite installations appropriately.
Not sure if this is necessary given how rarely the user_can() function is used. You should just do switch_to_blog(), user_can(), restore_current_blog().

Add user_can_for_blog function to capabilities.php