[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
User API: WP_Roles class
File Size: | 374 lines (9 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
WP_Roles:: (15 methods):
__construct()
__call()
_init()
reinit()
add_role()
remove_role()
add_cap()
remove_cap()
get_role()
get_names()
is_role()
init_roles()
for_site()
get_site_id()
get_roles_data()
__construct( $site_id = null ) X-Ref |
Constructor. param: int $site_id Site ID to initialize roles for. Default is the current site. |
__call( $name, $arguments ) X-Ref |
Makes private/protected methods readable for backward compatibility. param: string $name Method to call. param: array $arguments Arguments to pass when calling. return: mixed|false Return value of the callback, false otherwise. |
_init() X-Ref |
Sets up the object properties. The role key is set to the current prefix for the $wpdb object with 'user_roles' appended. If the $wp_user_roles global is set, then it will be used and the role option will not be updated or used. |
reinit() X-Ref |
Reinitializes the object. Recreates the role objects. This is typically called only by switch_to_blog() after switching wpdb to a new site ID. |
add_role( $role, $display_name, $capabilities = array() X-Ref |
Adds a role name with capabilities to the 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 the role a capability, set the value for that capability to false. param: string $role Role name. param: string $display_name Role display name. param: bool[] $capabilities Optional. List of capabilities keyed by the capability name, return: WP_Role|void WP_Role object, if the role is added. |
remove_role( $role ) X-Ref |
Removes a role by name. param: string $role Role name. |
add_cap( $role, $cap, $grant = true ) X-Ref |
Adds a capability to role. param: string $role Role name. param: string $cap Capability name. param: bool $grant Optional. Whether role is capable of performing capability. |
remove_cap( $role, $cap ) X-Ref |
Removes a capability from role. param: string $role Role name. param: string $cap Capability name. |
get_role( $role ) X-Ref |
Retrieves a role object by name. param: string $role Role name. return: WP_Role|null WP_Role object if found, null if the role does not exist. |
get_names() X-Ref |
Retrieves a list of role names. return: string[] List of role names. |
is_role( $role ) X-Ref |
Determines whether a role name is currently in the list of available roles. param: string $role Role name to look up. return: bool |
init_roles() X-Ref |
Initializes all of the available roles. |
for_site( $site_id = null ) X-Ref |
Sets the site to operate on. Defaults to the current site. param: int $site_id Site ID to initialize roles for. Default is the current site. |
get_site_id() X-Ref |
Gets the ID of the site for which roles are currently initialized. return: int Site ID. |
get_roles_data() X-Ref |
Gets the available roles data. return: array Roles array. |
Generated : Thu Nov 21 08:20:01 2024 | Cross-referenced by PHPXref |