Class JUser

Description

User class. Handles all application interaction with a user

  • since: 11.1

Located in /libraries/joomla/user/user.php (line 19)

JObject
   |
   --JUser
Variable Summary
 static array $instances
 string $activation
 integer $block
 string $email
 array $groups
 boolean $guest
 integer $id
 boolean $isRoot
 datetime $lastvisitDate
 string $name
 string $password
 datetime $registerDate
 integer $sendEmail
 string $username
 array $_authGroups
 array $_authLevels
 string $_errorMsg
Method Summary
 static JUser getInstance ([integer $identifier = 0])
 static object The getTable ([string $type = null], [string $prefix = 'JTable'])
 JUser __construct ([integer $identifier = 0])
 boolean authorise (string $action, [string $assetname = null])
 boolean bind (array &$array)
 mixed defParam (string $key, mixed $value)
 boolean delete ()
 array getAuthorisedCategories (string $component, string $action)
 mixed getParam (string $key, [mixed $default = null])
 object The getParameters ()
 boolean load (mixed $id)
 boolean save ([boolean $updateOnly = false])
 boolean setLastVisit ([integer $timestamp = null])
 mixed setParam (string $key, mixed $value)
 void setParameters (object $params)
Variables
static array $instances = array() (line 201)
  • var: JUser instances container.
  • since: 11.3
  • access: protected
string $activation = null (line 115)

Activation hash

  • since: 11.1
  • access: public
integer $block = null (line 83)

Block status

  • since: 11.1
  • access: public
string $email = null (line 59)

The email

  • since: 11.1
  • access: public
array $groups = array() (line 131)

Associative array of user names => group ids

  • since: 11.1
  • access: public
boolean $guest = null (line 139)

Guest status

  • since: 11.1
  • access: public
integer $id = null (line 35)

Unique id

  • since: 11.1
  • access: public
boolean $isRoot = null (line 27)

A cached switch for if this user has root access rights.

  • since: 11.1
  • access: protected
string $lastResetTime = null (line 147)

Last Reset Time

  • since: 12.2
  • access: public
datetime $lastvisitDate = null (line 107)

Date of last visit

  • since: 11.1
  • access: public
string $name = null (line 43)

The user's real name (or nickname)

  • since: 11.1
  • access: public
JRegistry $params = null (line 123)

User parameters

  • since: 11.1
  • access: public
string $password = null (line 67)

MD5 encrypted password

  • since: 11.1
  • access: public
string $password_clear = '' (line 75)

Clear password, only available when a new password is set for a user

  • since: 11.1
  • access: public
datetime $registerDate = null (line 99)

Date the user was registered

  • since: 11.1
  • access: public
int $resetCount = null (line 155)

Count since last Reset Time

  • since: 12.2
  • access: public
integer $sendEmail = null (line 91)

Should this user receive system email

  • since: 11.1
  • access: public
string $username = null (line 51)

The login name

  • since: 11.1
  • access: public
array $_authActions = null (line 187)

Authorised access actions

  • since: 11.1
  • access: protected
array $_authGroups = null (line 171)

Authorised access groups

  • since: 11.1
  • access: protected
array $_authLevels = null (line 179)

Authorised access levels

  • since: 11.1
  • access: protected
string $_errorMsg = null (line 195)

Error message

  • since: 11.1
  • access: protected
JRegistry $_params = null (line 163)

User parameters

  • since: 11.1
  • access: protected

Inherited Variables

Inherited from JObject

JObject::$_errors
Methods
static getInstance (line 240)

Returns the global User object, only creating it if it doesn't already exist.

  • return: The User object.
  • since: 11.1
  • access: public
static JUser getInstance ([integer $identifier = 0])
  • integer $identifier: The user to load - Can be an integer or string - If string, it is converted to ID automatically.
static getTable (line 514)

Method to get the user table object

This function uses a static variable to store the table name of the user table to instantiate. You can call this function statically to set the table name if needed.

  • return: user table object
  • since: 11.1
  • access: public
static object The getTable ([string $type = null], [string $prefix = 'JTable'])
  • string $type: The user table name to be used
  • string $prefix: The user table prefix to be used
Constructor __construct (line 210)

Constructor activating the default information of the language

  • since: 11.1
  • access: public
JUser __construct ([integer $identifier = 0])
  • integer $identifier: The primary key of the user to load (optional).

Redefinition of:
JObject::__construct()
Class constructor, overridden in descendant classes.
authorise (line 330)

Method to check JUser object authorisation against an access control object and optionally an access extension object

  • return: True if authorised
  • since: 11.1
  • access: public
boolean authorise (string $action, [string $assetname = null])
  • string $action: The name of the action to check for permission.
  • string $assetname: The name of the asset on which to perform the action.
bind (line 545)

Method to bind an associative array of data to a user object

  • return: True on success
  • since: 11.1
  • access: public
boolean bind (array &$array)
  • array &$array: The associative array to bind to the object
defParam (line 314)

Method to set a default parameter if it does not exist

  • return: Set parameter value
  • since: 11.1
  • access: public
mixed defParam (string $key, mixed $value)
  • string $key: Parameter key
  • mixed $value: Parameter value
delete (line 808)

Method to delete the JUser object from the database

  • return: True on success
  • since: 11.1
  • access: public
boolean delete ()
getAuthorisedCategories (line 378)

Method to return a list of all categories that a user has permission for a given action

  • return: List of categories that this group can do this action to (empty array if none). Categories must be published.
  • since: 11.1
  • access: public
array getAuthorisedCategories (string $component, string $action)
  • string $component: The component from which to retrieve the categories
  • string $action: The name of the section within the component from which to retrieve the actions.
getAuthorisedGroups (line 433)

Gets an array of the authorised user groups

  • since: 11.1
  • access: public
array getAuthorisedGroups ()
getAuthorisedViewLevels (line 411)

Gets an array of the authorised access levels for the user

  • since: 11.1
  • access: public
array getAuthorisedViewLevels ()
getParam (line 284)

Method to get a parameter value

  • return: The value or the default if it did not exist
  • since: 11.1
  • access: public
mixed getParam (string $key, [mixed $default = null])
  • string $key: Parameter key
  • mixed $default: Parameter default value
getParameters (line 476)

Method to get the user parameters

This method used to load the user parameters from a file.

  • return: user parameters object.
  • deprecated: 12.3 (Platform) & 4.0 (CMS) - Instead use JUser::getParam()
  • since: 11.1
  • access: public
object The getParameters ()
load (line 839)

Method to load a JUser object by user id number

  • return: True on success
  • since: 11.1
  • access: public
boolean load (mixed $id)
  • mixed $id: The user id of the user to load
save (line 674)

Method to save the JUser object to the database

  • return: True on success
  • since: 11.1
  • throws: RuntimeException
  • access: public
boolean save ([boolean $updateOnly = false])
  • boolean $updateOnly: Save the object only if not a new user Currently only used in the user reset password method.
setLastVisit (line 457)

Pass through method to the table for setting the last visit date

  • return: True on success.
  • since: 11.1
  • access: public
boolean setLastVisit ([integer $timestamp = null])
  • integer $timestamp: The timestamp, defaults to 'now'.
setParam (line 299)

Method to set a parameter

  • return: Set parameter value
  • since: 11.1
  • access: public
mixed setParam (string $key, mixed $value)
  • string $key: Parameter key
  • mixed $value: Parameter value
setParameters (line 495)

Method to get the user parameters

  • since: 11.1
  • access: public
void setParameters (object $params)
  • object $params: The user parameters object

Inherited Methods

Inherited From JObject

 JObject::__construct()
 JObject::def()
 JObject::get()
 JObject::getError()
 JObject::getErrors()
 JObject::getProperties()
 JObject::set()
 JObject::setError()
 JObject::setProperties()
 JObject::__toString()

Documentation generated on Tue, 19 Nov 2013 15:16:21 +0100 by phpDocumentor 1.4.3