Public Member Functions | Static Public Member Functions | Protected Attributes

User Class Reference

Inheritance diagram for User:
Collaboration diagram for User:

List of all members.

Public Member Functions

 __construct ($paramarray=array())
 insert ()
 update ()
 delete ()
 remember ()
 forget ($redirect=true)
 count_posts ($status=false)
 can ($token, $access= 'any')
 can_any ($token_access=array())
 cannot ($token)
 grant ($tokens, $access= 'full')
 deny ($tokens)
 revoke ($tokens)
 in_group ($group)
 add_to_group ($group)
 remove_from_group ($group)
 __get ($name)
 get_url_args ()
 field_save ($key, $value)
 field_load ($key)
 content_type ()

Static Public Member Functions

static default_fields ()
static anonymous ()
static identify ()
static create ($paramarray)
static authenticate ($who, $pw)
static get ($who)
static get_by_id ($id)
static get_by_name ($username)
static get_by_email ($email)
static get_id ($user)
static commenter ()

Protected Attributes

 $url_args

Detailed Description

Definition at line 33 of file user.php.


Constructor & Destructor Documentation

User::__construct ( paramarray = array()  ) 

Constructor for the User class

Parameters:
array $paramarray an associative array of initial User fields

Definition at line 64 of file user.php.


Member Function Documentation

User::__get ( name  ) 

Capture requests for the info object so that it can be initialized properly when the constructor is bypassed (see PDO::FETCH_CLASS pecularities). Passes all other requests to parent.

Parameters:
string $name requested field name
Returns:
mixed the requested field value

Definition at line 639 of file user.php.

User::add_to_group ( group  ) 

function add_to_group

Parameters:
integer|string|UserGroup $group A group ID, name, or UserGroup instance
Returns:
null

Definition at line 607 of file user.php.

Referenced by insert().

static User::anonymous (  )  [static]

Build and return the anonymous user

Returns:
object user object

Definition at line 80 of file user.php.

Referenced by UserGroup::__get(), AdminGroupsHandler::ajax_groups(), AdminGroupsHandler::get_group(), and identify().

static User::authenticate ( who,
pw 
) [static]

Check a user's credentials to see if they are legit -- calls all auth plugins BEFORE checking local database.

Parameters:
string $who A username
string $pw A password
Returns:
User|boolean a User object, or false

Definition at line 282 of file user.php.

Referenced by AtomHandler::is_auth().

User::can ( token,
access = 'any' 
)

Determine if a user has a specific token permission

Parameters:
string $token The name of the token for which to check permission
string $access The type of access to check for (read, write, full, etc.)
Returns:
boolean True if this user has the requested access, false if not

Definition at line 490 of file user.php.

Referenced by can_any().

User::can_any ( token_access = array()  ) 

Determine if a user has any of a set of tokens

Parameters:
array $token_access An array of tokens and the permissions to check for each of them.
Returns:
boolean True if this user has the requested access, false if not

Definition at line 502 of file user.php.

User::cannot ( token  ) 

Determine if a user has been denied access to a specific token

Parameters:
string $token The name of the token to detect
Returns:
boolean True if this user has been denied access to the requested token, false if not

Definition at line 531 of file user.php.

static User::commenter (  )  [static]

Returns an array of information about the commenter If this is a logged-in user, then return details from their user profile. If this is a returning commenter, then return details from their cookie otherwise return empty strings.

Returns:
Array an array of name, email and URL

Definition at line 463 of file user.php.

User::content_type (  ) 

Returns the content type of the object instance

Returns:
array An array of content types that this object represents, starting with the most specific

Implements IsContent.

Definition at line 763 of file user.php.

User::count_posts ( status = false  ) 

Returns the number of posts written by this user

Parameters:
mixed A status on which to filter posts (published, draft, etc). If false, no filtering will be performed. Default: no filtering
Returns:
int The number of posts written by this user

Definition at line 451 of file user.php.

static User::create ( paramarray  )  [static]

Creates a new user object and saves it to the database

Parameters:
array An associative array of user fields
Returns:
User the User object that was created

Definition at line 135 of file user.php.

static User::default_fields (  )  [static]

Get default fields for this record.

Returns:
array an array of the fields used in the User table

Definition at line 50 of file user.php.

Referenced by field_save(), and Users::get().

User::delete (  ) 

Delete a user account

Definition at line 200 of file user.php.

User::deny ( tokens  ) 

Deny permissions to one or more tokens to this user

Parameters:
mixed The token ID or name to be denied, or an array of the same

Definition at line 557 of file user.php.

User::field_load ( key  ) 

Loads form values from an object

Parameters:
string $key The name of a form component that will be loaded
Returns:
mixed The stored value returned

Definition at line 747 of file user.php.

User::field_save ( key,
value 
)

Stores a form value into the object

Parameters:
string $key The name of a form component that will be stored
mixed $value The value of the form component to store

Definition at line 718 of file user.php.

User::forget ( redirect = true  ) 

Delete the user id from the session

Parameters:
boolean $redirect Redirect the user to base_url after destroying session?

Definition at line 240 of file user.php.

static User::get ( who  )  [static]

Fetch a user from the database by name, ID, or email address. This is a wrapper function that will invoke the appropriate get_by_* method.

Parameters:
mixed $who user ID, username, or e-mail address
Returns:
object User object, or false

Definition at line 346 of file user.php.

Referenced by UserHandler::act_password_reset(), add_to_group(), commenter(), get_by_email(), get_by_id(), get_by_name(), get_id(), ACL::get_user_token_access(), insert(), remove_from_group(), Posts::search_to_get(), and ACL::user_tokens().

static User::get_by_email ( email  )  [static]

Select a user from the database by its email address

Parameters:
string $email The email address of a user
Returns:
User The User object of the specified user

Definition at line 416 of file user.php.

Referenced by get().

static User::get_by_id ( id  )  [static]

Select a user from the database by its id

Parameters:
int $id The id of a user
Returns:
User The User object of the specified user

Definition at line 374 of file user.php.

Referenced by AtomHandler::add_posts(), AdminGroupsHandler::ajax_groups(), AdminUsersHandler::edit_user_apply(), Undelete::filter_post_delete_allow(), get(), AtomHandler::get_entry(), and identify().

static User::get_by_name ( username  )  [static]

Select a user from the database by its username

Parameters:
string $username The name of a user
Returns:
User The User object of the specified user

Definition at line 395 of file user.php.

Referenced by WPImport::action_auth_ajax_wp_import_users(), authenticate(), get(), AdminUsersHandler::get_user(), and FormValidators::validate_username().

static User::get_id ( user  )  [static]

Return the id of a user

Parameters:
mixed $user The id, name, or email address of a user
Returns:
integer The id of the specified user or false if that user doesn't exist

Definition at line 437 of file user.php.

User::get_url_args (  ) 

Returns a set of properties used by URL::get to create URLs

Returns:
array Properties of this post used to build a URL

Definition at line 704 of file user.php.

User::grant ( tokens,
access = 'full' 
)

Assign permissions to one or more new tokens to this user

Parameters:
mixed A token ID, name, or array of the same
string The access to grant

Definition at line 541 of file user.php.

Referenced by deny().

static User::identify (  )  [static]

Check for the existence of a cookie, and return a user object of the user, if successful

Returns:
User user object, or false if no valid cookie exists

Definition at line 96 of file user.php.

Referenced by AdminUsersHandler::__construct(), AdminHandler::__construct(), AjaxHandler::act_auth_ajax(), UserHandler::act_logout(), CoreDashModules::action_block_content_latest_log_activity(), CoreBlocks::action_block_content_meta_links(), FlickrSilo::action_plugin_ui_confirm(), FlickrSilo::action_plugin_ui_deauthorize(), Undelete::action_template_header(), FeedbackHandler::add_comment(), Charcoal::add_template_vars(), Theme::add_template_vars(), AdminDashboardHandler::ajax_dashboard(), Theme::check_scope_criteria(), Post::comment_form(), commenter(), AdminUsersHandler::edit_user_apply(), CoreDashModules::filter_block_list(), CoreDashModules::filter_dash_module_post_types_and_statuses(), AdminHandler::filter_menus_by_permission(), AdminCommentsHandler::form_comment(), ControlStorage::from_storage_string(), LogEntry::get(), Posts::get(), Comments::get(), Post::get_access(), Comment::get_access(), Monolith::get_blocks(), AdminDashboardHandler::get_dashboard(), DateTime::get_default_date_format(), DateTime::get_default_datetime_format(), DateTime::get_default_time_format(), AdminPostsHandler::get_publish(), AdminUsersHandler::get_user(), AdminUsersHandler::get_users(), AtomHandler::is_auth(), EventLog::log(), RewriteRule::match(), AdminPostsHandler::post_posts(), FlickrSilo::silo_contents(), Post::update(), AdminGroupsHandler::validate_add_group(), AdminUsersHandler::validate_add_user(), AdminUsersHandler::validate_delete_user(), AdminUsersHandler::validate_delete_users(), AdminUsersHandler::validate_edit_user(), and Utils::WSSE().

User::in_group ( group  ) 

function in_group Whether or not this user is is in the specified group

Parameters:
int|string $group a group ID or name
Returns:
bool Whether or not this user is in the specified group

Definition at line 596 of file user.php.

User::insert (  ) 

Save a new user to the users table

Definition at line 145 of file user.php.

User::remember (  ) 

Save the user id into the session

Definition at line 225 of file user.php.

User::remove_from_group ( group  ) 

function remove_from_group removes this user from a group

Parameters:
integer|string|UserGroup $group A group ID, name, or UserGroup instance
Returns:
null

Definition at line 622 of file user.php.

User::revoke ( tokens  ) 

Remove permissions to one or more tokens from a user

Parameters:
mixed a token ID, name, or array of the same

Definition at line 566 of file user.php.

User::update (  ) 

Updates an existing user in the users table

Definition at line 183 of file user.php.


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