4

I have enabled some optional profile fields for the registered users of my website (using the User-Profile plugin), What are the Joomla variable which will return the value of these fields?
I mean, if we want to display the name of the logged in user, we use $user->usernamevariable.
I want to display the following optional fields :
City
Country
Website
About Me

Which variables will return the value of these optional fields?

1 Answer 1

5

Very simple bit of code to use as shown below

$user = JFactory::getUser();
$profile = JUserHelper::getProfile($user->id);

echo '<p>City: ' . $profile->profile['city'] . '</p>';
echo '<p>Country: ' . $profile->profile['country'] . '</p>';
echo '<p>Website: ' . $profile->profile['website'] . '</p>';
echo '<p>About me: ' . $profile->profile['aboutme'] . '</p>';

Enjoy :)

1
  • thank you Lodder! :) now please help with my other question which is still unanswered.
    – saibbyweb
    May 23, 2014 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.