GB_User_Roles::add_role
Add role name with capabilities to list.
Updates the list of roles, if the role doesn't already exist. The capabilities are defined in the following format `array( 'read' => true );` To explicitly deny a role a capability you set the value for that capability to false.
Signature
public function add_role(string
$role,
string
$display_name,
[array
$capabilities = ] )
Parameters
$role
— string
Role name.$display_name
— string
Role display name.$capabilities
— array
List of role capabilities in the above format.
Returns
- GB_Role|null
- GB_Role object if role is added, null if already exists.
Violations
Checkstyle
Line | Column | Severity | Message |
---|---|---|---|
1112 | 12 | error | Method name "GB_User_Roles::add_role" is not in camel caps format |
1114 | 9 | error | Inline control structures are not allowed |
1121 | 9 | error | Inline control structures are not allowed |