API16:JFactory/getUser
From Joomla! Documentation
Description
Get an user object
<! removed transcluded page call, red link never existed >
Syntax
static 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
object
Defined in
libraries/joomla/factory.php
Importing
jimport( 'joomla.factory' );
Source Body
public static function getUser($id = null)
{
jimport('joomla.user.user');
if (is_null($id))
{
$instance = JFactory::getSession()->get('user');
if (!$instance INSTANCEOF JUser) {
$instance = &JUser::getInstance();
}
}
else
{
$instance = &JUser::getInstance($id);
}
return $instance;
}
<! removed transcluded page call, red link never existed >
Examples
Code Examples
Example
Jeeradate 06:03, 24 October 2010 (CDT) Edit comment