Make WordPress Core

Opened 7 years ago

Closed 3 years ago

#15819 closed enhancement (wontfix)

Create user_can_for_blog function

Reported by: mweichert Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Role/Capability Keywords: has-patch needs-testing needs-refresh
Focuses: Cc:


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)

user_can_for_blog.patch (1.2 KB) - added by mweichert 7 years ago.
Add user_can_for_blog function to capabilities.php
capabilities.php.diff (1.0 KB) - added by layotte 5 years ago.
Updated patch for user_can_for_blog to deal with non-multisite properly, etc.

Download all attachments as: .zip

Change History (8)

7 years ago

Add user_can_for_blog function to capabilities.php

#1 @markjaquith
7 years ago

  • Milestone changed from Awaiting Review to Future Release

5 years ago

Updated patch for user_can_for_blog to deal with non-multisite properly, etc.

#2 @layotte
5 years ago

Added a newer version, would be great to see this in a release soon :). The version I added deals with non-multisite installations appropriately.

#3 @nacin
5 years ago

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().

#4 @layotte
5 years ago

Yeah, that's what I ended up doing for the time being... figured it'd be good, since it's there for current_user_can_for_blog().

#5 @chriscct7
3 years ago

  • Keywords needs-refresh added

#6 @johnbillion
3 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

No movement in three years. Proposed function provides very little value.

Note: See TracTickets for help on using tickets.