Adding Custom User Profile Fields in Joomla 2.5 - Step 1/3 - Copy the Plugin
The default Joomla 2.5 user profile plugin allows your site users to input more information about themselves than what is by default allowed. You can find more information here on the fields included by default within the Joomla 2.5 user plugin.
There are many users that would like to add more fields to the plugin to make it work better for them. For example, if you're running a website about baseball, you may want to allow people to input their favorite baseball team or what position they play.
To add new fields to the user profile plugin, you will need to edit the plugin itself. This is not always an easy task, so be sure to find a solid tutorial, such as this one, that walks you through all of the needed steps. In the next few tutorials, we're going to show you how to create a custom user profile plugin so you can add additional custom profile fields.
In this first tutorial, we're going to make a copy of the current user profile plugin. We're not going to edit the current profile plugin because we may lose any changes we make if Joomla updates the files.
Steps to create a copy of the current user profile plugin in Joomla 2.5
- Create a folder on your desktop named profile10.
- Connect to your Joomla server via FTP.
- Copy all files in the plugins/user/profile folder into the profile10 plugin folder on your desktop.
- Copy the following files from /administrator/language/en-GB to the profile10 folder on your desktop.
- In the profile10 folder, Rename the following files:
en-GB.plg_user_profile.ini to en-GB.plg_user_profile10.ini
en-GB.plg_user_profile.sys.ini to en-GB.plg_user_profile10.sys.ini
- The following steps will require that we change several references of "profile" to "profile10", the name of our new user profile plugin. Find the following lines in the following files, and make the necessary changes.
Rename profile.xml to profile10.xml in the code of the file.
LINE 3: <name>plg_user_profile10</name> LINE 14: <filename plugin="profile10">profile10.php</filename> LINE 19: <language tag="en-GB">en-GB.plg_user_profile10.ini</language> LINE 20: <language tag="en-GB">en-GB.plg_user_profile10.sys.ini</language>
- Rename profile.php to profile10.php.
LINE 18: class plgUserProfile10 extends JPlugin
- Zip the profile10 folder on your desktop to profile10.zip.
- Check the User - Profile Plugin. If it is enabled, disable the standard User - Profile plugin
- Just like any other plugin, install the profile10.zip plugin.
Our next step is to update the user facing user profile form so that users can type in a value for the new field that you will be adding.
Thank you for your feedback!