class JUser extends JObject


Located at : UKNOWVA_ROOT/libraries/joomla/user/user.php

User class. Handles all application interaction with a user

Properties

integer $id Unique id
string $name The users real name (or nickname)
string $username The login name
string $email The email
string $password MD5 encrypted password
string $password_clear Clear password, only available when a new password is set for a user
string $usertype User type Used in Joomla 1.0 and 1.5 for access control.
integer $block Block status
integer $sendEmail Should this user receive system email
datetime $registerDate Date the user was registered
datetime $lastvisitDate Date of last visit
string $activation Activation hash
string $params User parameters
array $groups Associative array of user names => group ids
boolean $guest Guest status
$designation
$reports_to

Methods

__construct(integer $identifier)

Constructor activating the default information of the language

string
__toString()

Magic method to convert the object to a string gracefully.

from JObject
mixed
def(string $property, mixed $default = null)

Sets a default value if not alreay assigned

from JObject
mixed
get(string $property, mixed $default = null)

Returns a property of the object or the default value if the property is not set.

from JObject
array
getProperties(boolean $public = true)

Returns an associative array of object properties.

from JObject
string
getError(integer $i = null, boolean $toString = true)

Get the most recent error message.

from JObject
array
getErrors()

Return all errors, if any.

from JObject
mixed
set(string $property, mixed $value = null)

Modifies a property of the object, creating it if it does not already exist.

from JObject
boolean
setProperties(mixed $properties)

Set the object properties based on a named array/hash.

from JObject
void
setError(string $error)

Add an error message.

from JObject
string
toString() deprecated

No description

from JObject
static JUser
getInstance($identifier, $username_as_identifier = false)

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

mixed
getParam(string $key, mixed $default = null)

Method to get a parameter value

mixed
setParam(string $key, mixed $value)

Method to set a parameter

mixed
defParam(string $key, mixed $value)

Method to set a default parameter if it does not exist

boolean
authorize(string $action, string $assetname = null) deprecated

Proxy to authorise

boolean
authorise(string $action, string $assetname = null)

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

array
authorisedLevels() deprecated

Proxy to getAuthorisedViewLevels

array
getAuthorisedCategories(string $component, string $action)

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

array
getAuthorisedViewLevels()

Gets an array of the authorised access levels for the user

array
getAuthorisedGroups()

Gets an array of the authorised user groups

boolean
setLastVisit(integer $timestamp = null)

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

object
getParameters(boolean $loadsetupfile = false, path $path = null)

Method to get the user parameters

void
setParameters(object $params)

Method to get the user parameters

static object
getTable(string $type = null, string $prefix = 'JTable')

Method to get the user table object

boolean
bind(array $array)

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

boolean
save(boolean $updateOnly = false)

Method to save the JUser object to the database

boolean
delete()

Method to delete the JUser object from the database

boolean
load(mixed $id)

Method to load a JUser object by user id number

getParameter($param_name)

No description

setParameter($param_name, $value)

No description

isAdmin()

No description

isSuperAdmin()

No description

getSuperiors($includeadmins = false, $groups = array())

No description

getImmediateSuperiors($groups = array())

No description

getSubordinates($groups = array(), $keyword = null)

No description

getImmediateSubordinates($groups = array())

No description

isSuperiorOf($userid, $checkadmins = false)

No description

isImmediateSuperiorOf($userid)

No description

isSubordinateOf($userid, $checkadmins = false)

No description

isManager()

No description

sendNotification($content, $type = null, $link = null, $icon = null, $readonlyonce = true)

No description

getGlobalNotifications($return_count = false)

No description

markNotificationRead($type, $strict = false)

No description

sendSystemMail($subject, $body, $templateFile = '', $params = '', $status, $email_type = '')

No description

sendMail($subject, $body, $mode, $cc = null, $bcc = null, $attachment = null, $replyto = null, $replytoname = null)

No description

getSnapShot($include_thumbnail = true, $linkprofile = true, $open_link_in_new_window = true)

No description

getProfileAnchor($relative = true, $attributes = array(), $anchor_text = 'name')

No description

belongsToGroup($groupid)

No description

getTimeZone()

No description

getTimeZoneOffset($hours = true)

No description

verifyPassword($password)

No description

isSubscribedToTag($tag)

Since 2.5.1 Given a tag, checks if the user is subscribed to this tag, if not subscribed, then returns false, else returns true

assignCommunityGroups($community_groups = array())

No description

Details

at line 211
JObject __construct(integer $identifier)

Constructor activating the default information of the language

Parameters

integer $identifier The primary key of the user to load (optional).

Return Value

JObject

in JObject at line 56
string __toString()

Magic method to convert the object to a string gracefully.

Return Value

string The classname.

in JObject at line 70
mixed def(string $property, mixed $default = null)

Sets a default value if not alreay assigned

Parameters

string $property The name of the property.
mixed $default The default value.

Return Value

mixed

in JObject at line 88
mixed get(string $property, mixed $default = null)

Returns a property of the object or the default value if the property is not set.

Parameters

string $property The name of the property.
mixed $default The default value.

Return Value

mixed The value of the property.

See also

getProperties()

in JObject at line 107
array getProperties(boolean $public = true)

Returns an associative array of object properties.

Parameters

boolean $public If true, returns only the public properties.

Return Value

array

See also

get()

in JObject at line 133
string getError(integer $i = null, boolean $toString = true)

Get the most recent error message.

Parameters

integer $i Option error index.
boolean $toString Indicates if JError objects should return their error message.

Return Value

string Error message

in JObject at line 165
array getErrors()

Return all errors, if any.

Return Value

array Array of error messages or JErrors.

in JObject at line 180
mixed set(string $property, mixed $value = null)

Modifies a property of the object, creating it if it does not already exist.

Parameters

string $property The name of the property.
mixed $value The value of the property to set.

Return Value

mixed Previous value of the property.

in JObject at line 198
boolean setProperties(mixed $properties)

Set the object properties based on a named array/hash.

Parameters

mixed $properties Either an associative array or another object.

Return Value

boolean

See also

set()

in JObject at line 222
void setError(string $error)

Add an error message.

Parameters

string $error Error message.

Return Value

void

in JObject at line 235
string toString() deprecated

deprecated 12.1 Use magic method __toString()

Return Value

string

See also

__toString()

at line 238
static JUser getInstance($identifier, $username_as_identifier = false)

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

Parameters

$identifier
$username_as_identifier

Return Value

JUser The User object.

at line 277
mixed getParam(string $key, mixed $default = null)

Method to get a parameter value

Parameters

string $key Parameter key
mixed $default Parameter default value

Return Value

mixed The value or the default if it did not exist

at line 292
mixed setParam(string $key, mixed $value)

Method to set a parameter

Parameters

string $key Parameter key
mixed $value Parameter value

Return Value

mixed Set parameter value

at line 307
mixed defParam(string $key, mixed $value)

Method to set a default parameter if it does not exist

Parameters

string $key Parameter key
mixed $value Parameter value

Return Value

mixed Set parameter value

at line 324
boolean authorize(string $action, string $assetname = null) deprecated

deprecated 12.1

Proxy to authorise

Parameters

string $action The name of the action to check for permission.
string $assetname The name of the asset on which to perform the action.

Return Value

boolean True if authorised

at line 340
boolean authorise(string $action, string $assetname = null)

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

Parameters

string $action The name of the action to check for permission.
string $assetname The name of the asset on which to perform the action.

Return Value

boolean True if authorised

at line 384
array authorisedLevels() deprecated

deprecated 12.1

Proxy to getAuthorisedViewLevels

Return Value

array List of categories that this group can do this action to (empty array if none). Categories must be published.

at line 399
array getAuthorisedCategories(string $component, string $action)

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

Parameters

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.

Return Value

array List of categories that this group can do this action to (empty array if none). Categories must be published.

at line 427
array getAuthorisedViewLevels()

Gets an array of the authorised access levels for the user

Return Value

array

at line 445
array getAuthorisedGroups()

Gets an array of the authorised user groups

Return Value

array

at line 466
boolean setLastVisit(integer $timestamp = null)

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

Parameters

integer $timestamp The timestamp, defaults to 'now'.

Return Value

boolean True on success.

at line 489
object getParameters(boolean $loadsetupfile = false, path $path = null)

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.

Parameters

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.

Return Value

object The user parameters object.

at line 526
void setParameters(object $params)

Method to get the user parameters

Parameters

object $params The user parameters object

Return Value

void

at line 545
static object getTable(string $type = null, string $prefix = 'JTable')

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.

Parameters

string $type The user table name to be used
string $prefix The user table prefix to be used

Return Value

object The user table object

at line 574
boolean bind(array $array)

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

Parameters

array $array The associative array to bind to the object

Return Value

boolean True on success

at line 677
boolean save(boolean $updateOnly = false)

Method to save the JUser object to the database

Parameters

boolean $updateOnly Save the object only if not a new user Currently only used in the user reset password method.

Return Value

boolean True on success

Exceptions

exception

at line 797
boolean delete()

Method to delete the JUser object from the database

Return Value

boolean True on success

at line 827
boolean load(mixed $id)

Method to load a JUser object by user id number

Parameters

mixed $id The user id of the user to load

Return Value

boolean True on success

at line 866
getParameter($param_name)

Parameters

$param_name

at line 875
setParameter($param_name, $value)

Parameters

$param_name
$value

at line 884
isAdmin()

at line 890
isSuperAdmin()

at line 897
getSuperiors($includeadmins = false, $groups = array())

Parameters

$includeadmins
$groups

at line 904
getImmediateSuperiors($groups = array())

Parameters

$groups

at line 912
getSubordinates($groups = array(), $keyword = null)

Parameters

$groups
$keyword

at line 919
getImmediateSubordinates($groups = array())

Parameters

$groups

at line 926
isSuperiorOf($userid, $checkadmins = false)

Parameters

$userid
$checkadmins

at line 933
isImmediateSuperiorOf($userid)

Parameters

$userid

at line 940
isSubordinateOf($userid, $checkadmins = false)

Parameters

$userid
$checkadmins

at line 946
isManager()

at line 952
sendNotification($content, $type = null, $link = null, $icon = null, $readonlyonce = true)

Parameters

$content
$type
$link
$icon
$readonlyonce

at line 958
getGlobalNotifications($return_count = false)

Parameters

$return_count

at line 966
markNotificationRead($type, $strict = false)

Parameters

$type
$strict

at line 974
sendSystemMail($subject, $body, $templateFile = '', $params = '', $status, $email_type = '')

Parameters

$subject
$body
$templateFile
$params
$status
$email_type

at line 994
sendMail($subject, $body, $mode, $cc = null, $bcc = null, $attachment = null, $replyto = null, $replytoname = null)

Parameters

$subject
$body
$mode
$cc
$bcc
$attachment
$replyto
$replytoname

at line 1003
getSnapShot($include_thumbnail = true, $linkprofile = true, $open_link_in_new_window = true)

Parameters

$include_thumbnail
$linkprofile
$open_link_in_new_window

at line 1015
getProfileAnchor($relative = true, $attributes = array(), $anchor_text = 'name')

Parameters

$relative
$attributes
$anchor_text

at line 1052
belongsToGroup($groupid)

Parameters

$groupid

at line 1059
getTimeZone()

at line 1067
getTimeZoneOffset($hours = true)

Parameters

$hours

at line 1079
verifyPassword($password)

Parameters

$password

at line 1094
isSubscribedToTag($tag)

Since 2.5.1 Given a tag, checks if the user is subscribed to this tag, if not subscribed, then returns false, else returns true

Parameters

$tag

at line 1104
assignCommunityGroups($community_groups = array())

Parameters

$community_groups