Adding Custom User Profile Fields in Joomla 2.5 - Step 2/3 - The Front End FormWritten by Brad Markle
If you're following our tutorial on adding custom fields to the Joomla 2.5 User Profile plugin, our next step is to edit the front-end form so the user can enter a value for the new field. The new field we're adding is a text field where users can type in the name of their favorite baseball team.
To edit the user profile form on the front end, you'll need to edit the following file:
You can look at the other code in the profile10/profiles/profile.xml file as an example, and in our testing at line 94 we added the following code:
<field name="baseballteam" type="text" id="baseballteam" description="Favorite Baseball Team Description Goes Here" filter="string" label="Favorite BaseBall Team" message="PLG_USER_PROFILE_FIELD_WEB_SITE_MESSAGE" size="30" />
As you can see, the name of our variable is baseballteam. The label is Favorite BaseBall Team, and the description is Favorite Baseball Team Description Goes Here.
You can see in the screenshot below how this new code affects our user facing user profile page:
|Viewing your profile||Editing your profile|
Our next step is to update our plugin's XML file so that Site Administrators have the option to toggle on/off whether this new user field will be required or not.