Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#46271 closed defect (bug) (invalid)

Class WP_User, methods add_cap/remove_cap are buggy

Reported by: mrpsiho's profile 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
6 years 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 6 years ago by mr.psiho (previous) (diff)

#2 @ocean90
6 years ago

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