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 $params
string $password
datetime $registerDate
integer $sendEmail
string $username
string $usertype
array $_authGroups
array $_authLevels
string $_errorMsg
object $_params
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])
array authorisedLevels ()
boolean authorize (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 $loadsetupfile = false], [path $path = null])
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 211)
  • var: JUser instances container.
  • since: 11.3
  • access: protected
string $activation = null (line 126)

Activation hash

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

Block status

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

The email

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

Array of ids of groups that user belongs to

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

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

Last Reset Time

  • since: Joomla 2.5.6
  • access: public
datetime $lastvisitDate = null (line 118)

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

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

Date the user was registered

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

Count since last Reset Time

  • since: Joomla 2.5.6
  • access: public
integer $sendEmail = null (line 102)

Should this user receive system email

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

The login name

  • since: 11.1
  • access: public
string $usertype = null (line 86)

User type Used in Joomla 1.0 and 1.5 for access control.

array $_authActions = null (line 197)

Authorised access actions

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

Authorised access groups

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

Authorised access levels

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

Error message

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

User parameters

  • since: 11.1
  • access: protected

Inherited Variables

Inherited from JObject

JObject::$_errors
Methods
static method getInstance (line 250)

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 method getTable (line 570)

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

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

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.
authorisedLevels (line 398)

Gets an array of the authorised access levels for the user

  • deprecated: 12.1
  • since: 11.1
  • access: public
array authorisedLevels ()
authorize (line 333)

Proxy to authorise

  • return: True if authorised
  • deprecated: 12.1
  • since: 11.1
  • access: public
boolean authorize (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 601)

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

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

Method to delete the JUser object from the database

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

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

Gets an array of the authorised user groups

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

Gets an array of the authorised access levels for the user

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

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

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.
  • 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.
load (line 878)

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

Method to save the JUser object to the database

  • return: True on success
  • since: 11.1
  • throws: exception
  • 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 487)

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

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

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()
JObject::__toString()

Documentation generated on Mon, 25 Jun 2012 14:00:29 -0500 by phpDocumentor 1.4.4