Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding custom field in default joomla 3.1.1 registration form

Tags:

php

joomla

Recently I have stumbled upon a situation in Joomla 3.1.1 where I need to add a custom field attached with default registration form.

I surfed the existing resources which say that I should navigate to joomla_root/components/com_users/models/forms/registration.xml and then change the file accordingly.

I have done that but nothing is showing up. I also need to change registration.php in model and controller too. So, I need your inputs on how to do that. I can't use profile plugin or commercial extensions.

    One more thing that I've noticed is the fact that changing registration.xml file and such things work perfectly fine in Joomla 2.5 but isn't working in 3.x.
like image 929
dhaval Avatar asked Jun 27 '13 07:06

dhaval


1 Answers

Joomla ships with a user plugin called "profile" which may contain the fields you want to add already.

In the administrator go to extensions/plugins, filter by type and choose "user", then find the "Profile" and open it. Check out the options on the right handside, enable the plugin and voila.

Warning: most templates override the registration form and they usually don't fire the correct plugin events. If this is the case, your users will only see the "standard" fields in the registration. And if you set any fields as required in the plugin, they will not be registered, but redirected to the complete registration page (the user component), where they will find the fields they already filled in except for the passwords, which can be quite annoying.

If the "profile" fields are not sufficient, copy the profile plugin and build your own.

Do NOT modify the profile plugin or com_users files like you have done, this is Joomla core and will be overwritten when you next upgrade.

like image 113
Riccardo Zorn Avatar answered Oct 20 '22 18:10

Riccardo Zorn