One of the advanced features of User Profiles Pro is the ability to enable authors and commenters to edit extended profiles. Extended profiles come with 22 "built-in" fields:

Date type fields:

  • birthdate

Basic text fields:

  • first_name
  • last_name
  • address
  • city
  • state
  • country
  • mobile_phone
  • land_phone
  • sex
  • marital_status
  • occupation
  • company

Long text fields (suitable for textareas):

  • signature
  • about_me
  • activities
  • interests
  • music
  • tv_shows
  • movies
  • books
  • quotes

Most sites, however, will not want to use every single one of these fields. The list of fields available when editing an extended profile can be customized, in both the admin interface, and via the commenter profile interface.

Customizing Extended Profile Fields in the Admin (CMS) Interface

There are two ways to do this:

Edit the 'extended_profile_fields.tmpl' file found in /plugins/UserProfiles/tmpl, OR
Add a new template module (to the blog chosen in User Profiles settings) called "Extended Profile Fields". Note that it must be named this exactly. While you can start from scratch with this module, it likely easiest to copy and paste everything from the extended_profile_fields.tmpl mentioned above, and edit from there.

Each field in the default template looks something like this:

<mtapp:setting
id="city"
label="<__trans phrase="City">"
hint="<__trans phrase="The city where you live.">">
<input name="userprofiles_city" id="city" class="half-width" value="<mt:UserProfile field="city" escape="html">" />
</mtapp:setting>

As you can see from this example, this is the "city" field. Note that the "name" of the input field is always "userprofiles_field_name" -- this is important. Also note the "value" of the input field uses the <MTUserProfile field="field_name"> tag to dislay the current value of that field.

If you simply want to remove certain fields so user cannot see/edit them, you can safely delete sections like the one above. Alternatively, if you think you might want to add certain fields in the future, you may want to wrap the "inactive" fields in <mt:ignore> tags, as follows:

<mt:ignore>
<mtapp:setting
id="city"
label="<__trans phrase="City">"
hint="<__trans phrase="The city where you live.">">
<input name="userprofiles_city" id="city" class="half-width" value="<mt:UserProfile field="city" escape="html">" />
</mtapp:setting>

Customizing Extended Profile Fields in the Commenter Profile Interface

Note that by default, both the admin (CMS) interface and the commenter "edit profile" interface use the same 'extended_profile_fields.tmpl' discussed above. So if you edit that file, the change will be automatically detected in both interfaces, so you only have to make the change in once place.

That said, you may want separate them so that you can customize each separately. To customize the commenter interface fields independently, open the "Edit User Profile" template and look for the following line:

<mt:var name="fields">

This line tells MT to grab the field template code from the file mentioned above. You can replace this line with your own template code for the fields, or use an <MTInclude> tag to include the "Extended Profile Fields" module (as discussed above), or another module containing the fields. Either way, the best way may be to start with the contents of the default template file and customize from there.

Adding Custom Fields to the Extended Profile

While a subset of the above 22 fields may be enough for most sites, some site may want to add other custom fields to the Extended Profile. This can be done very easily, by simply adding another field to the field template(s) as discussed above. For example, suppose we want to add a field called "middle_name", we would add a field as follows:

<mtapp:setting
id="city"
label="<__trans phrase="Middle Name">"
hint="<__trans phrase="Your middle name.">">
<input name="userprofiles_middle_name" id="middle_name" class="half-width" value="<mt:UserProfile field="middle_name" escape="html">" />
</mtapp:setting>

Then save the template. Now a middle_name field will appear on the form and users will be able to add a middle name to their profile. Once again the naming convention of the "name" attribute is important here, it must be "userprofiles_field_name" or it won't work. If you have custom fields and they are not being saved in the database, make sure this naming convention is being used.

Customizing Published Profile Pages

Of course, once you have customized Extended Profile forms, you may want to customize the display of the "User Profile" template module to customize the display of the published profiles. Note that the default template is designed to only display fields that contain data. In other words, if the marital_status field is empty, this field won't be shown at all on the page. This can be a time saver -- if you simply want to remove certain fields from the form, you may not need to edit the User Profiles template at all (because the fields you removed will always be empty, so they won't display on the profile pages). However if you have added custom fields, or if you want to change the display order of the fields, you can do so by editing the "User Profile" module, much like you would edit any other MT template. Note the format for the <mt:UserProfile> tag is the same for both built-in and custom fields. As such, to add our middle name field to the profile, we would use:

<mt:UserProfile field="middle_name">

Finally, remember that the "User Profile" module is a special one in that when you save it, it will automatically republish all of the profile pages. When available, the plugin will do so as a background task so you won't have to wait for the rebuild to finish. After the publishing all the profile pages, the plugin will post a message to the system activity log, include the number of seconds that the process took to complete.