In Drupal complex tasks can be very easy. Sadly many times simple tasks can be complex. Even more often, to make a complex task simple, you have to make a simple task complex first. Such is the case with the content profile module. Note, this example uses Drupal 6.
Why Do I Want Content Profile?
The content profile module allows you to define a content type to represent your users profiles. This allows a tremendous amount of customization without dealing with code. You can use the CCK to define very complex node types to represent your users profiles. We will get to doing that later, unfortunately getting to the point where your content profiles look like…well…profiles takes a bit of doing. Be aware that there are many ways to do Profiles in Drupal and this is just one option, be sure you need this flexibility before you start down this path.
Setting Up Content Profile
First of course you have to install the content profile module and the CCK. You’re on your way now. Once the module is installed it will have created a profile content type. Great. Unfortunately you have a bunch of steps to go before it is usable at all. The first thing we need to do is designate that it’s a profile type by going to Administer->Content Types->Profile->Edit. In the last section, “Content Profile,” you will find a checkbox that reads “Use this content type as a content profile for users.”
Unfortunately of course a normal user can’t edit this content type, so go to Administer->User Management->Permissions and give your logged in users permissions to create and edit thier own Profile content. You do not want them to be able to edit other people’s content so do not give them the “edit any profile content” permission.
So you’d think we’d be close to done now, but if you now go and try to edit your profile you’ll see there’s a required title field. Even more annoyingly the only way to get rid of it is to add another module, the Automatic Node Titles module. Once you install this you go to the profile content type (Administer->Content Types->Profile->Edit again) and you’ll see a section at the top called “Automatic Title Generation.” Open that and set the option to “Automatically generate the title and hide the title field.” I don’t see any reason to care what the title will be since it will be used inside another page anyway so I don’t worry about setting any other options.
Now we’ve got it to where it’s reasonable to edit. You can go fill out the body field (as if it were a bio for example) and save and you’ll see it on your profile. Unfortunately you’ll also see a bloody “Submitted by X on …” line at the top of it. Great! To get rid of that go to Themes->Global Settings and in the upper right hand corner you’ll see a list of content types inside a box labeled “Display post information on.” Remove Profile and voila! We’ve managed to make an absolutely boring profile in Drupal with just 10 semi-easy steps.
Now you might be wondering why we went through all that trouble just to get a really bland profile that looks decent. The reason is because now that we’ve gotten a content profile set up and looking right, we can do the very complex task of making cool custom profiles very easily. We’ll address that later, but this should at least get you through the frustrating act of getting the initial profile set up. Let me know if anything needs clarification or if you disagree with anything.
Photo Credit: misteraitch