Adding Fields to Joomla 2.5 Registration Form
I am working on a project that requires a customized registration form for Joomla 2.5. On first glance it didn’t appear that Joomla 2.5 had much too offer. The closest thing I could find in the documentation was an article on how to create a profile plugin.
With additional research I found information on a user profile plugin that has been around since Joomla 1.6. Unfortunately there was not too much information on how to modify from the Joomla Community. Luckily I ran across this article on stackoverflow. That told me what I needed to know. I did need to work out a few details on my own, though, and thought I would share the whole process in case it saves someone else some time.
The basic process is this:
- Activate the user profile plugin
- If you need to add a select box, add a table with the appropriate choices to your database.
- Edit the file plugins/user/profile/profile.xml – this will modify the plugin parameters on the backend, and on the profile edit page
- Edit the file plugins/user/profile/profiles/profile.xml – this will add the new field(s) to the registration form
- Add your new field parameters to the language file.
The user profile plugin comes with some useful fields and some not-so-useful fields. The person who decided that “Favorite Book” was a good default field definitely lives on a different planet than I do. But that’s OK.
If you only need to add text fields, your best bet is to just rename the default fields in the language file (location below). If you need a dropdown, select field though, you’ll need to do a little more.
Step One – Activate the user profile plugin. This should be self explanatory.
Step Two – Add the table with your dropdown choices to the database. If this isn’t self explanatory, then maybe you shouldn’t be trying this.
Step Three – Edit the following file:
This will add your fields to the plugin administration and edit profile page. This is the basic format of the tag you’ll add, but you can copy, paste and modify any of the existing field tags in the file:
Step 4 – Edit the following file:
This will add your field to the actual registration form. Since you’ve come this far I assume you’re adding a select field, and you’ll need to write the SQL to full that info from your new table.
Here’s my code:
query=”SELECT role_id as value, role_name as role FROM #__myfield_role ORDER by role”
Step 5 – Finally, name your parameters in the language file here:
Hope that helps! Let me know if it works for you.