Make WordPress Core

Opened 5 years ago

Last modified 5 years ago

#45197 new enhancement

Introduce `user_can_for_blog()`

Reported by: johnbillion's profile johnbillion Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Role/Capability Keywords: needs-unit-tests has-patch
Focuses: multisite Cc:

Description

The available user capability checking functions include:

  • current_user_can()
  • user_can()
  • current_user_can_for_blog()

What's missing is user_can_for_blog() so that both a user ID and a site ID can be passed in order to check a given user's capabilities on a given site.

Attachments (1)

45197.diff (1.1 KB) - added by tmanoilov 5 years ago.

Download all attachments as: .zip

Change History (3)

#1 @johnjamesjacoby
5 years ago

+1 to this.

I have coded some version of this logic at least a few times (into private methods in plugins.)

I can adapt something into a patch, but it’s pretty straight forward.

Version 0, edited 5 years ago by johnjamesjacoby (next)

@tmanoilov
5 years ago

#2 @tmanoilov
5 years ago

  • Keywords has-patch added; needs-patch removed

Hey guys, I'm at WordCamp Sofia 2018 Contributors day and this is the first patch I'm submitting. I'm not able to fully test it so I'm looking forward to a review. Thanks in advance.

Note: See TracTickets for help on using tickets.