Property | Type | Description | |
---|---|---|---|
$activeRoles | array | An array with all active roles | |
$all_roles | array | Array with the list of all roles. | |
$arrayCapabilitiesByRole | array | An key value pairs array with key = role and value = list of capabilities. | |
$arrayCountUsersByRole | array | List with count role group by user | |
$count | integer | Number of roles | |
$inactiveRoles | array | An array with all inactive roles | |
$wordPressRoles | array | Default WordPress roles |
Method | Description | |
---|---|---|
__construct ( ) : WPDKUserRoles | Create an instance of WPDKUserRoles class | |
activeRoles ( ) : array | ||
add_role ( string $role, string $display_name, array $capabilities = [], string $description = '', string $owner = '' ) : null | WP_Role | Updates the list of roles, if the role doesn't already exist. | |
arrayCapabilitiesByRole ( ) : array | Create An key value pairs array with key = role and value = list of capabilities. | |
countUsersByRole ( ) : array | Set the arrayCountUsersByRole property with the list of user count by role. | |
getInstance ( ) : WPDKUserRoles | Create a singleton instance of WPDKUserRoles class | |
get_instance ( ) : WPDKUserRoles | Create a singleton instance of WPDKUserRoles class | |
inactiveRoles ( ) : array | ||
init ( ) : WPDKUserRoles | Create a singleton instance of WPDKUserRoles class | |
invalidate ( ) : WPDKUserRoles | Used to invalidate static (internal singleton) and refresh all roles list | |
remove_role ( string $role ) | Remove a role | |
roleExists ( string $role ) : boolean | Return TRUE if the role exists | |
rolesWithCaps ( WPDKCapability | string | array $caps ) : array | Return the roles id list with one or more caps | |
statusRoles ( ) | Set the activeRoles and inactiveRoles properties array. | |
wordPressRoles ( ) : mixed | void | Return a key value pairs array with name of role and extends info. |
public __construct ( ) : WPDKUserRoles | ||
return | WPDKUserRoles |
public add_role ( string $role, string $display_name, array $capabilities = [], string $description = '', string $owner = '' ) : null | WP_Role | ||
$role | string | Role name. |
$display_name | string | Role display name. |
$capabilities | array | Optional. List of role capabilities in the above format. |
$description | string | Optional. An extend description for this role. |
$owner | string | Optional. Owner of this role |
return | null | WP_Role |
public arrayCapabilitiesByRole ( ) : array | ||
return | array |
public countUsersByRole ( ) : array | ||
return | array |
public static getInstance ( ) : WPDKUserRoles | ||
return | WPDKUserRoles |
public static get_instance ( ) : WPDKUserRoles | ||
return | WPDKUserRoles |
public static init ( ) : WPDKUserRoles | ||
return | WPDKUserRoles |
public static invalidate ( ) : WPDKUserRoles | ||
return | WPDKUserRoles |
public roleExists ( string $role ) : boolean | ||
$role | string | Role key name |
return | boolean |
public statusRoles ( ) |
public wordPressRoles ( ) : mixed | void | ||
return | mixed | void |
public array $arrayCapabilitiesByRole | ||
return | array |
public array $arrayCountUsersByRole | ||
return | array |
public array $inactiveRoles | ||
return | array |