WPDK
1.5.0
WordPress Development Kit
|
Public Member Functions | |
__construct () | |
Construct. More... | |
activeRoles () | |
Active roles. More... | |
inactiveRoles () | |
Inactive roles. More... | |
countUsersByRole ($user_role= '') | |
Counts the number of users for roles. More... | |
arrayCapabilitiesByRole () | |
List of caps for role. More... | |
roleExists ($role) | |
Check if a role exists. More... | |
wordPressRoles () | |
WordPress default roles. More... | |
add_role ($role, $display_name, $capabilities=array(), $description= '', $owner= '') | |
Add role name with capabilities to list. More... | |
remove_role ($role) | |
Role. More... | |
selectCapabilitiesWithRole ($role) | |
Static Public Member Functions | |
static | init () |
Get singleton instance. More... | |
static | getInstance () |
Get singleton instance. More... | |
static | invalidate () |
Invalidate. More... | |
Data Fields | |
const | OPTION_KEY = '_wpdk_roles_extends' |
The option key prefix. More... | |
const | SUPER_ADMIN = 'super-admin' |
const | ADMINISTRATOR = 'administrator' |
const | EDITOR = 'editor' |
const | AUTHOR = 'author' |
const | CONTRIBUTOR = 'contributor' |
const | SUBSCRIBER = 'subscriber' |
$activeRoles | |
Active roles. More... | |
$inactiveRoles | |
Inactive roles. More... | |
$wordPressRoles | |
WordPress. More... | |
$count | |
Counts of roles. More... | |
$arrayCountUsersByRole | |
Array with count for user. More... | |
$arrayCapabilitiesByRole | |
List of caps for role. More... | |
An extended version of WordPress WP_Roles model.
Definition at line 1786 of file wpdk-user.php.
__construct | ( | ) |
Construct.
Create an instance of WPDKRoles class
Definition at line 1928 of file wpdk-user.php.
activeRoles | ( | ) |
Active roles.
Gets all the roles that have users for the site.
Definition at line 1966 of file wpdk-user.php.
add_role | ( | $role, | |
$display_name, | |||
$capabilities = array() , |
|||
$description = '' , |
|||
$owner = '' |
|||
) |
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.
In this overide method you can extends the capapilities array with format `array( 'read' => true, 'description' => 'Thsi capability allow access to...' );`
string | $role | Role name. |
string | $display_name | Role display name. |
array | $capabilities | Optional. List of role capabilities in the above format. |
string | $description | Optional. An extend description for this role. |
string | $owner | Optional. Owner of this role |
Definition at line 2148 of file wpdk-user.php.
arrayCapabilitiesByRole | ( | ) |
List of caps for role.
Create An key value pairs array with key = role and value = list of capabilities.
Definition at line 2071 of file wpdk-user.php.
countUsersByRole | ( | $user_role = '' | ) |
Counts the number of users for roles.
Return the global or singular count for role. Counts the number of users for all roles on the site and returns this as an array. If the $user_role is input, the return value will be the count just for that particular role.
string | $user_role | Optional. The role to get the user count for. |
Definition at line 2021 of file wpdk-user.php.
|
static |
Get singleton instance.
Create a singleton instance of WPDKRoles class
Definition at line 1896 of file wpdk-user.php.
inactiveRoles | ( | ) |
Inactive roles.
Gets all the roles that do not have users for the site.
Definition at line 1991 of file wpdk-user.php.
|
static |
Get singleton instance.
Create a singleton instance of WPDKRoles class
Definition at line 1884 of file wpdk-user.php.
|
static |
Invalidate.
Used to invalidate static (internal singleton) and refresh all roles list
Definition at line 1911 of file wpdk-user.php.
remove_role | ( | $role | ) |
roleExists | ( | $role | ) |
Check if a role exists.
Return TRUE if the role exists
string | $role | Role key name |
Definition at line 2097 of file wpdk-user.php.
selectCapabilitiesWithRole | ( | $role | ) |
Return the HTML markup for a combo select
string | WPDKRole | $role | Role |
Definition at line 2196 of file wpdk-user.php.
wordPressRoles | ( | ) |
WordPress default roles.
Return a key value pairs array with name of role and extra info.
Definition at line 2109 of file wpdk-user.php.
array $activeRoles |
array $arrayCapabilitiesByRole |
List of caps for role.
An key value pairs array with key = role and value = list of capabilities.
Definition at line 1856 of file wpdk-user.php.
array $arrayCountUsersByRole |
Array with count for user.
List with count role group by user
Definition at line 1847 of file wpdk-user.php.
int $count |
array $inactiveRoles |
array $wordPressRoles |
const ADMINISTRATOR = 'administrator' |
Definition at line 1798 of file wpdk-user.php.
const AUTHOR = 'author' |
Definition at line 1800 of file wpdk-user.php.
const CONTRIBUTOR = 'contributor' |
Definition at line 1801 of file wpdk-user.php.
const EDITOR = 'editor' |
Definition at line 1799 of file wpdk-user.php.
const OPTION_KEY = '_wpdk_roles_extends' |
The option key prefix.
The extra data are save in option table with this prefix
Definition at line 1794 of file wpdk-user.php.
const SUBSCRIBER = 'subscriber' |
Definition at line 1802 of file wpdk-user.php.
const SUPER_ADMIN = 'super-admin' |
Definition at line 1797 of file wpdk-user.php.