How to display user profile information in Joomla 3 & Joomla 5
In this article, we will learn: How to get Joomla 3 & Joomla 5 current logged in user object or if we want to get specific user details pass userid, and get its profile.
Problem: I want to make a custom profile page which will only display the details of the user who has logged into my website. I need to display.
Solution
1. Joomla 3 site code
jimport( 'joomla.user.helper' );
$user = JFactory::getUser();
$userId = $user->id;
$userProfile = JUserHelper::getProfile( $userId );
echo "Address :" . $userProfile->profile['address1'];
2. Joomla 5 site code
use Joomla\CMS\Factory; // Place it top of your code
use Joomla\CMS\User\UserHelper;
$user= Factory::getUser($row->id);
$userId = $user->id;
$userProfile = UserHelper::getProfile( $userId );
echo "Address :" . $userProfile->address1;
Hope this helped.
Still need help! no problem, feel free to contact us Today