WordPress.org

Make WordPress Core

Opened 9 months ago

Last modified 8 months ago

#45197 new enhancement

Introduce `user_can_for_blog()`

Reported by: 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 8 months ago.

Download all attachments as: .zip

Change History (3)

#1 @johnjamesjacoby
9 months 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 if anyone wants to try.

Last edited 9 months ago by johnjamesjacoby (previous) (diff)

@tmanoilov
8 months ago

#2 @tmanoilov
8 months 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.