[ Index ]

WordPress 5.4.1

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    




/wp-includes/ -> class-wp-role.php (summary)

User API: WP_Role class

File Size: 111 lines (3 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Role:: (4 methods):

Class: WP_Role  - X-Ref

Core class used to extend the user roles API.

__construct( $role, $capabilities )   X-Ref
Constructor - Set up object properties.

The list of capabilities, must have the key as the name of the capability
and the value a boolean of whether it is granted to the role.

param: string $role         Role name.
param: bool[] $capabilities List of capabilities keyed by the capability name,

add_cap( $cap, $grant = true )   X-Ref
Assign role a capability.

param: string $cap Capability name.
param: bool $grant Whether role has capability privilege.

remove_cap( $cap )   X-Ref
Removes a capability from a role.

This is a container for WP_Roles::remove_cap() to remove the
capability from the role. That is to say, that WP_Roles::remove_cap()
implements the functionality, but it also makes sense to use this class,
because you don't need to enter the role name.

param: string $cap Capability name.

has_cap( $cap )   X-Ref
Determines whether the role has the given capability.

The capabilities is passed through the {@see 'role_has_cap'} filter.
The first parameter for the hook is the list of capabilities the class
has assigned. The second parameter is the capability name to look for.
The third and final parameter for the hook is the role name.

param: string $cap Capability name.
return: bool True if the role has the given capability. False otherwise.

Generated: Tue May 19 15:51:04 2020 Cross-referenced by PHPXref 0.7.1