The Content Profile module creates a new content type called Profile when it is enabled. By default, this content type is set to be used as a profile. We need to complete a few additional steps to make our profile fully functional.
As mentioned above, when the Content Profile module is enabled, it creates a new content type named Profile. To use this new node type effectively, we need to change the default settings.
To do this, click on the Administer | Site building | Content types link, or navigate to admin/content/types. Click the Edit link for the Profile content type.
The Automatic Nodetitles module—enabled earlier in the first part of this article—adds a new fieldset labeled Automatic title generation at the top of the administrative screens where we edit content types.
As shown in the preceding screenshot, we have two options. For the first option, we want to select Automatically generate the title and hide the title field.
For the second option—Pattern for the title—we should enter [author-name]’s profile. [author-name] is a token; when the node is created, the token will be replaced by the username of the person creating the node. So, if a user named Jill created the profile node, the title would be Jill’s profile.
The Token module allows us to use a wide range of tokens in addition to [author-name]. To see the full list of available tokens, expand the Replacement patterns fieldset as indicated in the preceding screenshot by Item 1.
The settings listed here also need to be adjusted:
After you have made the necessary adjustments, click the Save content type button to submit the form and save your changes.
To configure the base Content Profile settings, click on the Administer Site building | Content types link, or navigate to admin/content/types. Click the Edit link for the Profile content type. Then, click the Content Profile tab.
The base settings allow us to configure how the node profile will be displayed on the user profile page. As shown in the preceding screenshot, in the User page display style section we have four options:
The final two options—Include an edit link to the display and Show a link to the content profile creation page, if there is no profile—should both be selected, as they improve usability.
The Weight can be left at 0.
When these settings have been adjusted as needed, click the Submit button to save the changes.
Now that we have edited the defaults of the Profile node type, and adjusted the base settings of the Content Profile, we are ready to add fields and taxonomy terms to our profile. The CCK fields and Taxonomies will provide structure to our user profiles.
For this example, we want to extend our profile by adding two fields, and one vocabulary.
The fields we will add will both be text fields; one for a Brief bio, and the second for a Full bio.
We will also add a Vocabulary to the Profile content type called Interests. Adding this vocabulary is covered in the next section of this article.
To add the text fields, go to the Content Types administration page by clicking the Administer | Content Management | Content Types link, or by navigating to admin/content/types. Click the manage fields link for the profile content type.
In the Add section, we want to add a New field. Enter the following values:
Click the Save button; this brings up the admin screen where you can configure the field.
As shown in the preceding screenshot, the form to configure the text field has two sections: Profile settings and Global settings.
In the Profile settings, we have two options; enter the values specified below:
For this example, we do not need to set any Default value.
In the Global settings, we have four options; enter the values specified below:
For this example, we do not need to set any Allowed values.
Once the field has been configured as needed, click the Save field settings button to save your changes.
Adding the Full Bio is nearly identical to adding the Brief bio. When adding the field, use the following values:
Click the Save button; this brings up the admin screen where you can configure the field.
In the Profile settings, enter:
In the Global settings, we enter:
Once the field has been configured as needed, click the Save field settings button to save your changes.
As we discussed above when we configured the base options for Content Profiles, we want to show the node teaser on the user profile page. To take advantage of this option, we need to configure how we display our fields. To do this, go to the Content Types administration page by clicking the Administer | Content Management | Content Types link, or by navigating to admin/content/types. Click the edit link for the profile content type, and then, click the Display fields tab.
As seen in the preceding screenshot, you can control how fields are displayed in the Teaser view and in the Full node view.
In the settings shown in the preceding screenshot, we have set the Brief bio to show on the Teaser view (that is, on the user profile page), and the Full bio to display on the Full node view (that is, when the entire profile is being viewed). Our settings display a truncated overview on the user profile page, with a link to the more detailed full node view.
As described above, we want to add an Interests vocabulary.
To add new vocabularies, click on the Administer | Content management | Taxonomy| link, or navigate to admin/content/taxonomy. Click the Add vocabulary tab.
For Interests, enter the following values:
Click the Save button to create the new vocabulary.
Click on the Administer User Management | Roles| link, or navigate to admin/user/roles. Select the role(s) that you would like to be able to create node-based profiles. Generally, users should be given the rights to create profile content, and edit own profile content. This will allow users to create their own profiles, and update them as needed, but also protects users from accidentally deleting their profile.
Only site administrators or especially trusted users should be given the rights to edit any profile content or delete any profile content.
I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…
Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…
Once we learn how to deploy an Ubuntu server, how to manage users, and how…
Key-takeaways: Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…
While developing a web application, or setting dynamic pages and meta tags we need to deal with…
Software architecture is one of the most discussed topics in the software industry today, and…