Joomla Tutorials and Blog Posts

User Meta Plugin Extends Joomla's User Fields

September 17, 2010 | Written by Steve Burge

User Meta is a small plugin that allows you to collect extra information from your users.

Most solutions to this problem require you to install a large and complex extension. Although User Meta does require a little coding it is a small and lightweight solution. Here's how you use it.

Download User Meta

tutuploadstutuploadstutuploadsmedia_1284730825816.png

Go to Joomlacode.org and download the User Meta plugin.

Upload User Meta

tutuploadstutuploadstutuploadsmedia_1284730917614.png

In your Joomla site, go to Extensions >> Install/Uninstall and upload the User Meta plugin. Then go to Extensions >> Plugin Manager and enable the plugin.

Setting Up the User Fields

tutuploadstutuploadsmedia_1284734098149.png

Next, we'll go and set up our extra user fields. Open your file manager and browse to /plugins/system/usermeta/. Open the user.xml file.

What you'll see are the current parameters that users see. These are "Back-end Language", "Front-end Language", "WYSYWYG Editor for this User", "Help Site for this User" and "Time Zone for this User":

tutuploadstutuploadsmedia_1284734156732.png

Add Your Own Fields

tutuploadstutuploadsmedia_1284734376785.png

You can create your own parameters in here using Joomla's default system. It's the same plugin language used for all templates and extensions. I've chosen to use a radio button for this example, hence type="radio".

If you have any predefined choices you can save them using options as in the example above. When you save your user.xml file, go and login to the front of your site and visit the normal Joomla user account page. It should look like the image below:

tutuploadstutuploadstutuploadsmedia_1284732564632.png

Adding the Fields to Your Site's Registration

tutuploadstutuploadstutuploadsmedia_1284732447739.png

You can also add these fields to any Joomla layout page. However, it makes sense to add it to the registration form so you can collect this information when people join. All you need to do is insert: {UserMeta}. In order to use it in the registration form, I've edited /components/com_user/views/register/tmpl/default.php. The result is shown below:

tutuploadstutuploadstutuploadsmedia_1284732616218.png

 

Remember Not to Hack Core Files

If you do use this last technique for your site's registration, rather than hack the core registration file, it's best to just override it. Copy the file from /components/com_user/views/register/tmpl/default.php to /templates/your-template-name/html/com_content/register/default.php


 

Comments  

 
#1 allisons 2010-09-22 09:30
Where can you view the additional information that you've collected, on the back end?
 
 
#2 kl6H_steve 2010-09-22 09:34
Hi allisons

Two choices:

1) You'd need to also edit the administrator display files, perhaps for com_user

2) You can access the information from the database in the _users table and the params field.
 
 
#3 Syahril Zulkefli 2011-01-24 11:53
can you include link to the plugin? i cannot find it in joomlacode.org.

thank you.
 
 
#4 iowawebco 2011-01-24 14:50
Hi Syahril,

Welcome to OsTraining :-)

Here you go:

joomlacode.org/.../frs

Kind regards,
Nick
 
 
#5 Syahril Zulkefli 2011-01-25 04:40
Thank you Nick.
 
 
#6 iowawebco 2011-01-25 10:32
You are welcome! :-)
 
 
#7 dannette 2011-09-15 09:30
I have been using usermeta for a few years now and have developed my own auth plugin based on a date field in usermeta. I've been using Joomla 1.5. Would this work in Joomla 1.7? I am faced with wondering when I can migrate and this would hamper at least 3 big sites.
 
 
#8 iowawebco 2011-09-15 10:49
Hi and welcome, Dannette!

Unfortunately the developer has only made it available for 1.5. You could port it yourself though since it's Open Source. Alternatively there are other extensions that you can use to get user data that are available for 1.7

Kind regards,
Nick
 

Add comment