How to Print User Details in Joomla?

How to Print User Details in Joomla?

How to Print a User Name in Joomla If you want to edit any template or module and print in a single line details about your user you can simply use Joomla getUser() function

First of all you need to do is creating a reference to the global user object


// First of all you need to do is creating a reference to the global user object
$user = JFactory::getUser();
if (!$user->guest) { // we are checking if the current visitor is logged in or just a guest
echo 'You are logged in as:';
echo 'User name: ' . $user->username . '';
echo 'Real name: ' . $user->name . '';
echo 'User ID : ' . $user->id . '';
} // We also can use getUser for a spesific user:
$user = JFactory::getUser( '232' ); // we call here the user with id 232

JoomShaper
Popup now! Make a Difference!