Adding Custom User Profile Fields in Joomla 2.5 – Step 2/3 – The Front End Form

Joomla 2.5 has reached its end of life as for 12/31/2014. Please be advised this may be a security risk to your website. You can view more information about the end of life here.

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:

/plugins/user/profile10/profiles/profile.xml

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
viewing-the-form

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.

Thoughts on “Adding Custom User Profile Fields in Joomla 2.5 – Step 2/3 – The Front End Form

  • Can you store the Custom User Profile Fields in a “custom” database table?  What modifications would be needed to make that work?

Leave a Reply