Joomla! Platform 12.1

 Class JUser

Description

User class. Handles all application interaction with a user

  • since: 11.1

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

Class JObject   (Subpackage Object)

Class JUser   (Subpackage User)
Variable Summary
Static variable static array $instances
Variable string $activation
Variable integer $block
Variable string $email
Variable array $groups
Variable boolean $guest
Variable integer $id
Variable boolean $isRoot
Variable datetime $lastvisitDate
Variable string $name
Variable string $params
Variable string $password
Variable datetime $registerDate
Variable integer $sendEmail
Variable string $username
Variable array $_authGroups
Variable array $_authLevels
Variable string $_errorMsg
Variable object $_params
Method Summary
Static method static JUser getInstance ([integer $identifier = 0])
Static method static object The getTable ([string $type = null], [string $prefix = 'JTable'])
Constructor JUser __construct ([integer $identifier = 0])
Method boolean authorise (string $action, [string $assetname = null])
Method boolean bind (array &$array)
Method mixed defParam (string $key, mixed $value)
Method boolean delete ()
Method array getAuthorisedCategories (string $component, string $action)
Method mixed getParam (string $key, [mixed $default = null])
Method object The getParameters ([boolean $loadsetupfile = false], [path $path = null])
Method boolean load (mixed $id)
Method boolean save ([boolean $updateOnly = false])
Method boolean setLastVisit ([integer $timestamp = null])
Method mixed setParam (string $key, mixed $value)
Method void setParameters (object $params)
Variables
string $activation = null (line 114)

Activation hash

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

Block status

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

The email

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

Associative array of user names => group ids

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

Guest status

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

Unique id

  • since: 11.1
  • access: public
array $instances = array() (line 183)
  • var: JUser instances container.
  • since: 11.3
  • access: protected
boolean $isRoot = null (line 27)

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

  • since: 11.1
  • access: protected
datetime $lastvisitDate = null (line 106)

Date of last visit

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

The users real name (or nickname)

  • since: 11.1
  • access: public
string $params = null (line 122)

User parameters

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

MD5 encrypted password

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

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

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

Date the user was registered

  • since: 11.1
  • access: public
integer $sendEmail = null (line 90)

Should this user receive system email

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

The login name

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

Authorised access actions

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

Authorised access groups

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

Authorised access levels

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

Error message

  • since: 11.1
  • access: protected
object $_params = null (line 145)

User parameters

  • since: 11.1
  • access: protected

Inherited Variables

Inherited from JObject

Variable JObject::$_errors
Methods
Constructor __construct (line 192)

Constructor activating the default information of the language

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

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

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 515)

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 288)

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 755)

Method to delete the JUser object from the database

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

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 399)

Gets an array of the authorised user groups

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

Gets an array of the authorised access levels for the user

  • since: 11.1
  • access: public
array getAuthorisedViewLevels ()
getInstance (line 222)

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

  • return: The User object.
  • since: 11.1
  • access: public
JUser getInstance (integer $identifier)
  • integer $identifier: The user to load - Can be an integer or string - If string, it is converted to ID automatically.
getParam (line 258)

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 446)

Method to get the user parameters

This function tries to load an XML file based on the user's usertype. The filename of the xml file is the same as the usertype. The functionals has a static variable to store the parameters setup file base path. You can call this function statically to set the base path if needed.

  • return: user parameters object.
  • deprecated: 12.3
  • since: 11.1
  • access: public
object The getParameters ([boolean $loadsetupfile = false], [path $path = null])
  • boolean $loadsetupfile: If true, loads the parameters setup file. Default is false.
  • path $path: Set the parameters setup file base path to be used to load the user parameters.
getTable (line 484)

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
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
load (line 787)

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 629)

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 422)

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 273)

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 465)

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()
/html>