Book Image

Learning Joomla! 1.5 Extension Development

Book Image

Learning Joomla! 1.5 Extension Development

Overview of this book

Table of Contents (17 chapters)
Learning Joomla! 1.5 Extension Development
Credits
About the Author
About the Reviewer
Preface

Getting user information


When we checked out a record in the previous section, we used the getUser() function from the JFactory class to get a reference to the current user object. We only used the id and the name properties of this object, but more are available, along with some member functions. To show more of the properties available, add the following task function userInfo() to the controller in the /components/ com_critic/critic.php file:

function userInfo()
{
$user =& JFactory::getUser();
?>
<p>Name: <?php echo $user->name; ?></p>
<p>Username: <?php echo $user->username; ?></p>
<p>Email: <?php echo $user->email; ?></p>
<p>User Type: <?php echo $user->usertype; ?></p>
<p>User Group ID: <?php echo $user->gid; ?></p>
<p>Register Date: <?php echo JHTML::_('date', $user->registerDate); ?></p>
<p>Last Visit Date: <?php echo JHTML::_('date', $user...