WPDev.one
Core Class

WP_User

class WP_User // Constructor: function Object() { [native code] }

Core class used to implement the WP_User object.

Methods 28 methods

Method / Return Description
__construct()
void

Constructor.

Parameters: $id: mixed, $name: mixed, $site_id: mixed
init()
void

Sets up object properties, including capabilities.

Parameters: $data: mixed, $site_id: mixed
get_data_by()
(object

Returns only the main user fields.

Parameters: $field: mixed, $value: mixed
__isset()
bool

Magic method for checking the existence of a certain custom field.

Parameters: $key: mixed
__get()
mixed

Magic method for accessing custom fields.

Parameters: $key: mixed
__set()
void

Magic method for setting custom user fields.

Parameters: $key: mixed, $value: mixed
__unset()
void

Magic method for unsetting a certain custom field.

Parameters: $key: mixed
exists()
bool

Determines whether the user exists in the database.

get()
mixed

Retrieves the value of a property or meta key.

Parameters: $key: mixed
has_prop()
bool

Determines whether a property or meta key is set.

Parameters: $key: mixed
to_array()
array

Returns an array representation.

__call()
(mixed

Makes private/protected methods readable for backward compatibility.

Parameters: $name: mixed, $arguments: mixed
_init_caps()
void

Sets up capability object properties.

Parameters: $cap_key: mixed
get_role_caps()
bool[]

Retrieves all of the capabilities of the user's roles, and merges them with

add_role()
void

Adds role to user.

Parameters: $role: mixed
remove_role()
void

Removes role from user.

Parameters: $role: mixed
set_role()
void

Sets the role of the user.

Parameters: $role: mixed
level_reduction()
int

Chooses the maximum level the user has.

Parameters: $max: mixed, $item: mixed
update_user_level_from_caps()
void

Updates the maximum user level for the user.

add_cap()
void

Adds capability and grant or deny access to capability.

Parameters: $cap: mixed, $grant: mixed
remove_cap()
void

Removes capability from user.

Parameters: $cap: mixed
remove_all_caps()
void

Removes all of the capabilities of the user.

has_cap()
bool

Returns whether the user has the specified capability.

Parameters: $cap: mixed, $args: mixed
translate_level_to_cap()
string

Converts numeric level to level capability name.

Parameters: $level: mixed
for_blog()
void

Sets the site to operate on. Defaults to the current site.

Parameters: $blog_id: mixed
for_site()
void

Sets the site to operate on. Defaults to the current site.

Parameters: $site_id: mixed
get_site_id()
int

Gets the ID of the site for which the user's capabilities are currently initialized.

get_caps_data()
bool[]

Gets the available user capabilities data.

Properties

Property / Type Description
$data
mixed
public
No description available.
$ID
mixed
public
No description available.
$caps
mixed
public
No description available.
$cap_key
mixed
public
No description available.
$roles
mixed
public
No description available.
$allcaps
mixed
public
No description available.
$filter
mixed
public
No description available.
$site_id
mixed
public
No description available.
$back_compat_keys
mixed
public
No description available.

Class Information

Since Version
2.0.0
Source File
wp-includes/class-wp-user.php
Advertisement