Customizing the user profile pages (a "before" and "after" example with screenshots)

This illustrative example shows how easy it is to override theme functions using the User_profile pages as an example.


This is how the out-of-the-box user profile looks like, with extra profile fields, such as City, Country, Postcode, Position etc. added in. (please note that i couldn't fit the whole page into the one screenshot..there is an extra "background/more info." field that doesn't show in the BEFORE screen shot.

click to view the BEFORE screenshot in a new window


This is how the exact same user profile looks after overriding the theme and applying a simple user_profile.tpl.php file in my theme directory.

click to view the AFTER screenshot in a new window

How I did it

To override just the layout of the User Profile page..I created a template.php file with this in it:

* Catch the theme_profile_profile function, and redirect through the template api

function phptemplate_user_profile($account, $fields = array()) {
// Pass to phptemplate, including translating the parameters to an associative array. The element names are the names that the variables
// will be assigned within your template.


Below are links to provide you with explanations and tips for some of the more technical settings on the "settings" page. If you just want to get Drupal up and running, you can safely ignore these settings. You'll always be able to come back and experiment with them later. The one possible exception to this is the "file system settings" which you may wish to set now. For more information on the "File system settings," click its link below. This link can also help you resolve issues with errors that often appear at the top of the "settings" page after Drupal is freshly installed.

Updating your modules

As Drupal develops with each release it becomes necessary to update modules to take advantage of new features and stay functional with Drupal's API.

Upgrading a theme to a new version

If you upgrade a site from one version of Drupal to another, you must take specific steps to make your theme compatible with the new version.

Always test the modifications on a separate development server before moving to a production site.


This template controls the display of a node, and a node summary. It can only affect the output of the $content variable.

Available variables

Node content, teaser if it is a summary.
Formatted creation date.
The directory the theme is located in, e.g. themes/garland or themes/garland/minelli.
The sequential ID of the node being displayed in a list.
True if the front page is currently being displayed.
Node links.
$main (4.6)
True if the node is appearing in a context, like the front page, where only the teaser should be shown. No longer used in 4.7 and later.
Formatted name of author.
$node (object)
The node object. To view all of the properties of a current $node object, put the following line of code in your node.tpl.php: <pre><?php print_r($node); ?></pre>
Link to node.
True if the node is being displayed by itself as a page.
HTML for user picture, if enabled.
True if the node is sticky.


Subscribe with RSS Subscribe to RSS - Drupal 4.7.x