WPDK  1.5.0
WordPress Development Kit
 All Data Structures Files Functions Variables Pages
WPDKCapabilities Class Reference

Public Member Functions

 get_cap ($cap_id)
 Get a capability. More...
 
 roleCapabilities ()
 Get all role capabilities. More...
 
 userCapabilities ()
 Capability users. More...
 
 allCapabilities ()
 All capabilities. More...
 
 usersCapability ()
 User caps. More...
 

Static Public Member Functions

static getInstance ()
 Singleton instance of WPDKCapabilities. More...
 
static defaultCapabilities ()
 Get all standard WordPress capabilities list. More...
 

Data Fields

const OPTION_KEY = '_wpdk_capabilities_extends'
 The option key prefix. More...
 
 $roleCapabilities
 All capabilities. More...
 
 $defaultCapabilities
 Only WordPress capabilities. More...
 
 $capabilities
 Only non-wordpress capabilities. More...
 
 $userCapabilities
 User capabiltity. More...
 
 $allCapabilities
 All capabilities. More...
 

Detailed Description

A capabilities class model.

Overview

You have not confuse the property as roleCapabilities by the method roleCapabilities(). The properties are a linear array such array( cap1, cap2, ..., capn). The method instead return a key values pair array such array( cap1 => array( cap1, desc, owner), ... ). The method return the extend information, the property only the name.

Author
=undo= info@.nosp@m.wpxt.nosp@m.re.me
Date
2012-11-28
Version
0.8.1

Definition at line 2237 of file wpdk-user.php.

Member Function Documentation

allCapabilities ( )

All capabilities.

Return a key value pairs array with all registered capabilities.

[cap] = [cap, desc, owner]
Returns
array

Definition at line 2581 of file wpdk-user.php.

static defaultCapabilities ( )
static

Get all standard WordPress capabilities list.

Return a key value pairs array with unique id key of capability and the description as value. Make sure we keep the default capabilities in case users screw 'em up. A user could easily remove a useful WordPress capability from all roles. When this happens, the capability is no longer stored in any of the roles, so it basically doesn't exist. This function will house all of the default WordPress capabilities in case this scenario comes into play.

For those reading this note, yes, I did "accidentally" remove all capabilities from my administrator account when developing this plugin. And yes, that was fun putting back together.

The Codex has a list of all the defaults: http://codex.wordpress.org/Roles_and_Capabilities#Capabilities

Returns
array $defaults All the default WordPress capabilities.

Definition at line 2392 of file wpdk-user.php.

get_cap (   $cap_id)

Get a capability.

Return an instance of WPDKCapability class or false if not exists

Parameters
string$cap_idCapability id
Returns
WPDKCapability

Definition at line 2358 of file wpdk-user.php.

static getInstance ( )
static

Singleton instance of WPDKCapabilities.

Return a singleton instance of WPDKCapabilities class

Returns
WPDKCapabilities

Definition at line 2309 of file wpdk-user.php.

roleCapabilities ( )

Get all role capabilities.

Gets an array of capabilities according to each user role. Each role will return its caps, which are then added to the overall $capabilities array.

Note that if no role has the capability, it technically no longer exists. Since this could be a problem with folks accidentally deleting the default WordPress capabilities, the members_default_capabilities() will return all the defaults.

[cap] = [cap, desc, owner]
Returns
array $capabilities All the capabilities of all the user roles.

Definition at line 2495 of file wpdk-user.php.

userCapabilities ( )

Capability users.

Return the capability added to user.

[cap] = [cap, desc, owner]
Note
This method is very different by usersCapability()
Returns
array

Definition at line 2541 of file wpdk-user.php.

usersCapability ( )

User caps.

Return a key value pairs array. For each user the list of its capabilties. This return array is used to hash from user id its capabilities.

[user_id] => [list of capabilities]
Note
This method is very different by userCapabilities()
Returns
array

Definition at line 2609 of file wpdk-user.php.

Field Documentation

All capabilities.

The list of all capabilities

Definition at line 2290 of file wpdk-user.php.

array $capabilities

Only non-wordpress capabilities.

This is the capabilities list without WordPress capabilties

Definition at line 2272 of file wpdk-user.php.

Only WordPress capabilities.

The standard WordPress capabilities list

Definition at line 2263 of file wpdk-user.php.

All capabilities.

All capabilities in all roles

Definition at line 2254 of file wpdk-user.php.

User capabiltity.

The list of capabilities added to users

Definition at line 2281 of file wpdk-user.php.

const OPTION_KEY = '_wpdk_capabilities_extends'

The option key prefix.

The extra data are save in option table with this prefix

Definition at line 2245 of file wpdk-user.php.


The documentation for this class was generated from the following file: