Drupal: How To Content Profile Basics
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.
Thank you so much. I’ve been a bit lost trying to understand how to use the Content Profile module and this tutorial explains why. There are just so many different scattered steps. Thanks for writing the tutorial.
Thanks for the info on the Content Profile module. Any info on this seems to be quite rare. It is a shame you stopped just when things were getting interesting.
How do you remove the Body field from the profile page? Do I have to resort to theme overrides for this?
Can I get this to appear on the same page as some of the other profile information so it is more obvious to the user that it needs to be completed?
If I have to have the profile on a tab instead of the main form, how do I re-arrange the tabs to make it more obvious?
I have different user profiles depending on the role (which is possible using Content Profile) but how do I get the users to fill in the extra sections after their role has been changed?
Is there another part to this article? You hinted that there would be at the end.
Thank you! Amazing it takes so much effort for every aspect of Drupal, and amazing it all seems to work! I could find no documentation on the module site, though did not check the ReadMe file….
You wrote:
getting to the point where your content profiles look like…well…profiles takes a bit of doing
…but where is this expanded on? I am looking for ways to customize the appearance of the Content Profile profile page, hopefully using Views and not having to make a call to every array element in the .tpl.php file. Is there another part to this article? Any help would be greatly appreciated.
Thanks.