Свойство | Type | Description | |
---|---|---|---|
$countRoles | integer | The total number of roles |
Méthode | Description | |
---|---|---|
__construct ( ) | The class constructor, that extends in some part the default constructor of parent WP_Roles | |
add_cap_to_role ( string $sRoleName, string $sCapName, boolean $bCapValue = TRUE ) : mixed | Add an existing capability to a specific WordPress role | |
add_cap_to_user ( integer $iIDUser, string $sCapName, boolean $bCapValue = TRUE ) : mixed | Add an existing capability to a specific WordPress user | |
add_role ( string $sRoleName, string $sRoleLabel, array $aCapabilities = [] ) : mixed | Create a brand new role, with its capabilities. The add_role from parent is simply made more secure. | |
create_cap ( string $sCapName, string $sRole, boolean $bCapValue = TRUE, array $aNewData = [] ) : mixed | Create a brand new capability for a role, with some new params that extends normal WordPress handling. | |
delete_cap_from_role ( string $sRoleName, string $sCapName ) : mixed | Delete an existing capability from a specific WordPress role. | |
delete_cap_from_user ( integer $iIDUser, string $sCapName ) : mixed | Delete a capability from a specific WordPress user WARNING: with this method, I can ALSO DELETE A CAPABILITY FROM DEFAULT USERS, LIKE admin. Please use VERY CAREFULLY this facility. | |
delete_extended_cap_data ( string $sCapName, integer | array $aExtendedKey ) : TRUE | FALSE | Delete extended data about a specific capability. | |
delete_extended_role_data ( string $sRoleName, integer | array $aExtendedKey ) : TRUE | FALSE | Delete extended data about a specific role. | |
delete_role ( string $sRoleName ) : mixed | Delete an existing WordPress role. | |
get_all_caps ( integer $iGroupedBy = self::CAPS_NOT_GROUPED_BY_ROLE ) : array | Return a multidimensional array with all actual caps in the whole WordPress system, and all extended data eventually associated to them. | |
get_all_roles ( integer $iMode ) : array | If $iMode param is equal to self::WP_STANDARD, directly returns output of get_names() method of WP_Roles object. | |
get_cap_data ( string $sCapName ) : mixed | Get all data about a specific capability, including extended one. | |
get_caps_of_role ( string $sRoleName ) : mixed | Get all capabilities data about a specific role, including extended one. | |
get_caps_of_user ( integer $iIDUser ) : mixed | Get all capabilities data about a specific user, including extended one. | |
get_role_data ( string $sRoleName ) : mixed | Get all data about a specific role, including extended one. | |
get_user_role ( integer $iIDUser ) : array | WPDKError | Return the main role of a user in the whole WordPress system, with all extended data eventually associated to it. | |
set_extended_cap_data ( string $sCapName, array $aNewData ) : TRUE | FALSE | Set extended data about a specific capability, or update extended data for the same key. | |
set_extended_role_data ( string $sRoleName, array $aNewData ) : TRUE | FALSE | Set extended data about a specific role, or update extended data for the same key. | |
set_main_role_of_user ( integer $iIDUser, string $sRoleName ) : mixed | Set the main role of a WordPress user. |
Méthode | Description | |
---|---|---|
_countUsersByRole ( ) | Counts the number of users for every role on the site and set this value into the array of roles created by WP_Roles. | |
delete_extended_data ( string $sKey, integer | array $aExtendedKey ) : TRUE | FALSE | Delete options about extended data, with checks. | |
update_extended_data ( string $sKey, array $aNewData ) : TRUE | FALSE | Update options about extended data, with checks. |
public __construct ( ) |
static public add_cap_to_role ( string $sRoleName, string $sCapName, boolean $bCapValue = TRUE ) : mixed | ||
$sRoleName | string | - role name/key that receive the cap |
$sCapName | string | - capability name/key |
$bCapValue | boolean | (optional) boolean value of capability. Default to TRUE. |
Résultat | mixed | TRUE|WPDKError |
static public add_cap_to_user ( integer $iIDUser, string $sCapName, boolean $bCapValue = TRUE ) : mixed | ||
$iIDUser | integer | - user ID in WordPress environment |
$sCapName | string | - capability name/key |
$bCapValue | boolean | (optional) boolean value of capability. Default to TRUE. |
Résultat | mixed | TRUE|WPDKError |
public add_role ( string $sRoleName, string $sRoleLabel, array $aCapabilities = [] ) : mixed | ||
$sRoleName | string | - role name/key in DB and in the whole system |
$sRoleLabel | string | - label of role in WordPress environment ( i.e. in user settings ). |
$aCapabilities | array | (optional) Array of capabilities for this role. Default to array(). |
Résultat | mixed | WP_Role|WPDKError : the new role, or the error occurred. |
static public create_cap ( string $sCapName, string $sRole, boolean $bCapValue = TRUE, array $aNewData = [] ) : mixed | ||
$sCapName | string | - capability name/key in DB and in the whole system |
$sRole | string | - role the capability belongs to. |
$bCapValue | boolean | (optional) boolean value of capability. Default to TRUE. |
$aNewData | array | (optional) array of new extended data related to this cap. Default to array(). |
Résultat | mixed | TRUE|WPDKError |
static public delete_extended_cap_data ( string $sCapName, integer | array $aExtendedKey ) : TRUE | FALSE | ||
$sCapName | string | - capability name/key to delete extended data of. |
$aExtendedKey | integer | array | - ALL_EXTENDED_DATA, or an array of extended keys to delete. If this param is equal to ALL_EXTENDED_DATA, then all extended data related to the capability will be deleted. |
Résultat | TRUE | FALSE | : if the capability is in, return TRUE if its extended data has been deleted, FALSE otherwise. |
static public delete_extended_role_data ( string $sRoleName, integer | array $aExtendedKey ) : TRUE | FALSE | ||
$sRoleName | string | - role name/key to delete extended data of. |
$aExtendedKey | integer | array | - ALL_EXTENDED_DATA, or an array of extended keys to delete. If this param is equal to ALL_EXTENDED_DATA, then all extended data related to the role will be deleted. |
Résultat | TRUE | FALSE | : if the role is in, return TRUE if extended data has been delete, FALSE otherwise. |
static public delete_role ( string $sRoleName ) : mixed | ||
$sRoleName | string | - role name/key to delete |
Résultat | mixed | TRUE|WPDKError |
static public get_all_caps ( integer $iGroupedBy = self::CAPS_NOT_GROUPED_BY_ROLE ) : array | ||
$iGroupedBy | integer | - whether or not return the array grouped by role. self::CAPS_NOT_GROUPED_BY_ROLE means the array will be unidimensional; self::CAPS_GROUPED_BY_ROLE means the array will be grouped by single role. |
Résultat | array | All capabilities in WordPress system. |
static public get_all_roles ( integer $iMode ) : array | ||
$iMode | integer | - (optional) return mode. If it is equal to self::WP_STANDARD, the method returns the standard data from WP environment. |
Résultat | array | All roles in WordPress system, standard or extended, according to $iMode. |
static public get_cap_data ( string $sCapName ) : mixed | ||
$sCapName | string | - capability name/key to get data of. |
Résultat | mixed | array|FALSE : if the capability is in, return an array with all data about it |
static public get_caps_of_role ( string $sRoleName ) : mixed | ||
$sRoleName | string | - role to get data of. |
Résultat | mixed | array|FALSE : if the role is in, return an array with all data about its capabilities |
static public get_caps_of_user ( integer $iIDUser ) : mixed | ||
$iIDUser | integer | - user ID in WordPress environment |
Résultat | mixed | array|FALSE : if the user exists, return an array with all data about its capabilities |
static public get_role_data ( string $sRoleName ) : mixed | ||
$sRoleName | string | - role name/key to get data of. |
Résultat | mixed | array|FALSE : if the role is in, return an array with all data about it |
static public get_user_role ( integer $iIDUser ) : array | WPDKError | ||
$iIDUser | integer | - user ID in WordPress environment |
Résultat | array | WPDKError | The main role of the user, or an instance of WPDKError object in case of an error. |
static public set_extended_cap_data ( string $sCapName, array $aNewData ) : TRUE | FALSE | ||
$sCapName | string | - capability name/key to get data of. |
$aNewData | array | array of new extended data related to this cap. |
Résultat | TRUE | FALSE | : if the capability is in, return TRUE if extended data has been stored, FALSE otherwise. |
static public set_extended_role_data ( string $sRoleName, array $aNewData ) : TRUE | FALSE | ||
$sRoleName | string | - role name/key to get data of. |
$aNewData | array | array of new extended data related to this role. |
Résultat | TRUE | FALSE | : if the role is in, return TRUE if extended data has been stored, FALSE otherwise. |