Calcetines Extreme

Calcetines Extreme
Take care of you using the best socks

Saturday, January 12, 2013

Add custom field on joomla user registration


Problem:     
you need to add a new field on joomla user registration process, like a flag to confirm newsletter subscription

Solution:

This is actually really simple.

open your joomla database in your db manager. I generally do this in "PHPMYADMIN". 
From there open the table "jos_users" and then add your additional fields that you require.

Then you go into libraries/joomla/database/table/user.php and declare you variables. So if you added a country field then you declair the varible like so:

var $Country = null;

The next step in the process is editing the actual registration form. This is done by going to components/com_user/views/register/tmpl/default.php.

On some joomla reales there is important to edit diferent files, here is a list of the folder where you can find layouts to edits.



  • administrator/components/com_user/views/user/tmpl/ 
  • component/com_user/views/user/tmpl 
  • components/com_user/views/register/tmpl/ libraries/joomla/database/table/ 
  • template/xxx/html/com_user/register/ 
  • template/xxx/html/com_user/user

More information: