WordPress.org

Make WordPress Core

Opened 21 months ago

Closed 21 months ago

Last modified 20 months ago

#46271 closed defect (bug) (invalid)

Class WP_User, methods add_cap/remove_cap are buggy

Reported by: mr.psiho Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Users Keywords:
Focuses: Cc:

Description

Both methods use/make check in $this->caps, while capabilities are actually located in $this->allcaps. Therefore both these methods simply do not work at the moment.

Change History (2)

#1 @mr.psiho
21 months ago

  • Resolution set to invalid
  • Status changed from new to closed

Ok, I got it! (spoiler: it was not obvious at all!) What I wanted to restrict user doing something. So, I just have to use it like this: $user->add_cap( 'read_post', false );

Last edited 21 months ago by mr.psiho (previous) (diff)

#2 @ocean90
20 months ago

  • Milestone Awaiting Review deleted
  • Version 5.0.3 deleted
Note: See TracTickets for help on using tickets.