How to display user profile information?

Select your language

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
$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


 Abdul Waheed : (Hire Joomla & PHP Pakistani Freelancer)