JFactory/getUser
From Joomla! Documentation
< API15:JFactory
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Get an user object
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax[edit]
& getUser($id=null)
Parameter Name | Default Value | Description |
---|---|---|
$id | null | $id The user to load - Can be an integer or string - If string, it is converted to ID automatically. |
Returns[edit]
object
Defined in[edit]
libraries/joomla/factory.php
Importing[edit]
jimport( 'joomla.factory' );
Source Body[edit]
function &getUser($id = null)
{
jimport('joomla.user.user');
if(is_null($id))
{
$session =& JFactory::getSession();
$instance =& $session->get('user');
if (!is_a($instance, 'JUser')) {
$instance =& JUser::getInstance();
}
}
else
{
$instance =& JUser::getInstance($id);
}
return $instance;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples[edit]
Code Examples[edit]
Example
Jeeradate 06:03, 24 October 2010 (CDT) Edit comment