Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#24490 closed enhancement (fixed)

Pass $this to WP_User::has_cap()'s "user_has_cap" filter

Reported by: viper007bond's profile Viper007Bond Owned by: wonderboymusic's profile wonderboymusic
Milestone: 3.7 Priority: normal
Severity: normal Version: 3.5.1
Component: Role/Capability Keywords: has-patch 3.7-early
Focuses: Cc:

Description

When hooking into the user_has_cap filter to modify the result of a user's capability checks (for example current_user_can()), the filter is not provided access to the user's object. This is important for cases like where WP_User::for_blog() has been called but you only want to modify a user's capabilities for a certain blog.

Attachments (1)

24490.patch (587 bytes) - added by Viper007Bond 11 years ago.

Download all attachments as: .zip

Change History (5)

@Viper007Bond
11 years ago

#1 @Viper007Bond
11 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
11 years ago

  • Keywords 3.7-early added
  • Milestone changed from Awaiting Review to Future Release

#3 @wonderboymusic
11 years ago

  • Milestone changed from Future Release to 3.7

these are all marked 3.7-early

#4 @wonderboymusic
11 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 25329:

Add an additional available param (the WP_User instance) to the user_has_cap filter.

Props Viper007Bond.
Fixes #24490.

Note: See TracTickets for help on using tickets.