13

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

  • username
  • name
  • registered email

Is it also possible to create custom fields but not at the registation form, only when they login, they should be able to edit their profile page.

4 Answers 4

24

Joomla: Accessing User Info - The User Object

To get user information for the current user:

$user = JFactory::getUser();

It will return the User Object.
Here, some of the most common User Object's Properties:

  • id ($user->id)
  • name ($user->name)
  • username ($user->username)
  • groups ($user->groups)
  • email ($user->email).

You can check if the user is logged-in with the:

$user->guest; 

You can check for the user's access privileges with the authorize method, e.g:

$user->authorise('core.admin', 'com_component')


User Profiles

For extra custom fields, this depends on what you are trying to achieve. There is a Joomla core plugin "User Profile" which contains many custom profile fields and which you can customize further.


Update: Accessing the User Profile Data

jimport( 'joomla.user.helper' ); 
$user = JFactory::getUser();
$userId = $user->id; 
$userProfile = JUserHelper::getProfile( $userId );

echo "Main Address :" . $userProfile->profile['address1'];

At the other hand there are other 3rd party extensions like Community Builder, JomSocial, Easy Social that let you build a user community site, where you can have users with extended profile information. If you don't need to build a community, there are other extensions that either override/extend the com_user core component or they work in conjunction with it and give you extra control over the user management.

But as said, it depends on what you want to do. For example if you just plan to build a forum, the forum extensions have extra profile fields.

Of course there are always more advanced solutions like building your own component or application.


Links

4
7

@Lodder is correct. If you want just some basic fields, then you can use Joomla User Profile plugin, which comes with Joomla itself.

If you want to create some customized fields, then there are various options available like, Community Builder, JomSocial, EasySocial and other socila networking solution. But if don't want the full community solution then you can look for the extension which are built for only user profiling. Joom Profile can be an option for you.

1
5

You should really do some research before asking a question like this. 2 seconds on Google and you would have all the information you needed.

There is a in User Profile plugin that comes with Joomla. In the Joomla backend, go to

Extensions (top menu) >> Plugin Manager >> User Profile.

You will see the following custom fields:

  • Address 1
  • Address 2
  • City Region
  • Country
  • Postal / ZIP Code
  • Phone
  • Web site
  • Favourite Book
  • About Me
  • Date of Birth

You can choose which ones you want on the registration and profile page. If these fields aren't the ones you're looking for, then you might want to look at Community Builder. This extension allows you to add your own custom fields and integrates with other extensions.

2
  • 3
    I find your first sentence funny as this is the first result on Google for me. Though a bit of redundant information doesn't hurt anybody. Commented May 21, 2015 at 0:26
  • 2
    the whole point of questions like this, and the answers provided, is a better source of info than "stuff found on google" eg blog posts.
    – RozzA
    Commented Dec 4, 2016 at 21:28
2

In addition to the answers above, you might want to take a look at a plugin called Nice User Info. It can display some user information when a user is logged in. A free versiion is also available, but with limited functionality.

To use it, simply add {niceuserinfo:usergroup}, and supports the following information:

  • User ID
  • Full Name
  • Username
  • Email Address
  • Group Name(s)
  • Group ID(s)
  • Registration Date
  • Last Visit Date
  • Visitor’s IP Address

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