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



You can print user data easily with Joomla built in function getUser(). You can use this function for showing specific items, content to specific users


getUser()  joomla get user 

SPRING PROMO 25%0FF! UNTIL 1ST MAY! USE PROMO CODE NOW : springX Close
This is Floating Toolbar Module by PluginValley