Creating A Basic User Profile: Tips and Tricks

We’ve created many sites with user profiles, and every site seems to have a few differences, but there are certain best practices which I would like to share.

Module Requirements

This article concerns user profiles in Drupal 6, and recommends that you have the following modules installed:

Configuration Instructions

At its most basic, a user profile will contain a name and a bio. As you get fancier, you might want an image, some additional text fields, and maybe some link fields. For the most basic user profile, all you need is cck and content profile, however, invariably you will need to be able to sort your users by last name, and this is where things get tricky if you don’t plan ahead.

First make sure you have installed the modules indicated above and enabled them.

  1. Create a new content type with cck called “Profile”
  2. Create a text field for “First Name”
  3. Create a text field for “Last Name”
  4. Go to the “edit” screen for your “Profile” content type (something like /admin/content/node-type/profile), in the collapsed field set “Automatic Title Generation” select the radio button “Automatically generate the title and hide the title field” or “Automatically generate the title if the title field is left empty” — I usually hide the field –. In the “Pattern for the title” use tokens for the “First Name” and “Last Name” fields, which should look something like this “[field_first_name-raw] [field_last_name-raw]”.
  5. In the collapsed field set for “Submission Form Settings” change the “Title field label” to “Full Name” or “Display Name” and the “Body field label” to “Bio”
  6. In the collapsed field set for “Content Profile” check the box for “Use this content type as a content profile for users”
  7. After you submit the changes to the Profile content type you will have a new tab “Content Profile” (/admin/content/node-type/profile/profile) got there to configure the content profile module for this content type and choose the settings best for you.
  8. The last required step is to set the user permissions for creating and editing this type of content. If all users on your site should have a Profile, make sure you have set permissions for the authenticated user role to create and edit own profile.

Now you have a very basic user profile and one that you can sort alphabetically by last name. From the user perspective they do not need to add their Full Name and their First and Last Name, which is a good thing.

For some optional enhancements, you may want to add an imagefield to your Profile content type for a user Photo, using the imagefield module you can set size constraints for the photo which is a good thing. You may also want to add a link field to allow the user to include a link to their blog, or some other site, if you set the link field to a multiple value with an unlimited number of values then users can add links to their social media profiles on Twitter, Facebook, YouTube, etc…