Also valid for joomla 1.7 and 1.6 (no guarantees)
The normal joomla registration form contains just the basic things for a quick registration but for some people, not quick enough. The form has 6 fields; which is enough to scare some of your users away especially if what they want is just a tiny piece of information.
The form does not exactly collect too much information (as it seems); it just has some unwanted fields. For example, we can do without the confirm email and confirm password fields. Removing them leaves you with a tiny registration form with just four fields. Nice right?
Sadly, there is no available way to remove fields from the form using joomla admin back-end. Fortunately, you have two other options: to hard code or to use a third party component.
Yes; there are components out there that allows you to remove fields from joomla registration form, but I tried some of them out. They worked; I was able to remove three fields from the registration form but it has one big problem. The registered users were not been stored in the admin back-end. To me, it is completely useless to have registered user and you won't be able to see their information in the back-end. So I decided to take the hard code route. Here's how I did it.
* If you're a beginner, then you need to follow my instructions word for word so as to avoid mistakes.
Things you need for this tutorial
- Joomla already installed in your website
- Code or text editor (e.g Dreamweaver or notepad)
How to remove the confirm password field from joomla registration form
- Go to the root directory (the folder you installed joomla) of your joomla site
- Go to components/com_users/models/forms
- Duplicate the registration.xml file and save the duplicate as registration-backup (safety precaution)
- Open registration.xml in a code/text editor
- Comment out the password 2 code. That is, place <!-- at the beginning of the code and place --> at the end of the code (see code below)
- Delete the word equals from password 1
- Save the file
The resulting code should be exactly like the code below
*The code above is for password one and two, notice that equals has been removed from the validate line of password one. I also commented out the entire password 2 field by adding <!-- and -->(the code in purple color) at the beginning and end respectively.
- Go to the registration page in the front-end of your site or refresh your site to be sure you did it right.
How to remove the confirm email field from joomla registration form
To remove the confirm email field, comment out the code below in the same registration.xml file
* Notice that we added <!-- and -->(code in purple above) at the beginning and end of the email2 code
Yes a registration form with just four fields. Try it out, enter the required text in your registration form and click the register button.
Yea!! Success message.
Note: You need to edit the error messages for the password and email fields. If you enter an invalid email and password in your registration form, an error message will pop up saying that the passwords and emails do not match. Now that you have just one email and password field, you need to edit this message so you won't confuse your users. This tutorial explains how to add text to joomla registration form but you can use the same method to edit error messages and any other text in joomla.
That's it; except you want to go further. Some people sometimes don't want to take the names of their users; they believe that a username is enough. Are you one of those people? Yes? Follow the simple instructions below to remove the name field from the registration form.
How to remove the name field from joomla registration form
Warning! Before we remove the name field, let's talk about it for a while. The name field is a very important field in joomla, removing it will cause some issues. For example, in the administrator back-end user manager, the name of the user is a link to the edit user page; if you remove the name from the registration form, the name column will be empty which means that you won't have a link to the edit user page in the user manager table. There's an easy solution though; just click the check-box in front of the user and click edit at the top of the page.
Another issue might arise when you're using some third party components. For example I recently ran into a problem with a quiz component I installed in one of my joomla sites. The component used the name of the user to store results and other important stuff. Since my registration form does not have a name field, the name column in the administrator back-end of the quiz component was empty. I had to hard code the component to use the username of the registered users instead of their names. You won't be able to do that if you're a beginner.
Conclusion: If it's not that important to remove the name field, don't remove the name field. It's not worth the trouble. If you really have to, then follow the steps below.
In the same registration.xml file, comment out the name field. Just add <!-- in front of <field name=... and --> after size="30"/> then save the file (add the code in purple below)
That's not all, the name field will be gone from the form when you refresh but you'll get an error message when you try to register. That's because joomla validates the name field somewhere in its millions of codes. The good news is you don't have to find that code, I've done the hard part for you; cool right?
- From your root directory, go to this folder: libraries/joomla/database/table
- Duplicate the user.php file in the table folder, name it user-backup (safety precaution)
- Open it (user.php) in your code editor e.g. notepad
- Use the find function (ctrl f) in your code editor to look for this: Validate user information
- Once you find it, adjust the code as below. Just add // in front of each line beginning from if (trim.. } and stop at the curly bracket after return false. Please follow this instruction carefully.
*if you're using dreamweaver or other WYSIWYG editors they could sometimes mess up the arrangement of the code. If you open this file in dreamweaver and find that all the codes are pressed together instead of in separate lines; just close it and open the file in a plain text editor (e.g. notepad)
- Save the file.
Refresh your site and try to register.
Yep; Success message
That's it. Your brand new registration form with just three fields.
Other tutorials you might be interested in: