Last updated 26 August 2009. Created on 24 January 2006.
Edited by bekasu, bryan kennedy, mike stewart, add1sun. Log in to edit this page.


This describes how to override the default user list page layout when using phptemplate based themes and the profile.module.

The user list page is displayed when you click on For an example, click through to the user list page.

Using this override you can control precisely which profile fields are displayed and their positioning/layout.

Step 1 of 2

In a text editor like notepad.exe, create a file called template.php using the the following snippet. If you already have a template.php file, simply add it to your existing one.


 * This snippet works with Drupal 4.7 
 * and will NOT work with Drupal 4.5 or Drupal 4.6

function phptemplate_profile_listing($user, $fields = array()) {
 * This snippet catches the default user list pages layout
 * and looks for a profile_listing.tpl.php file in the same folder
 * which has the new layout.
return _phptemplate_callback('profile_listing', array('user' => $user, 'fields' => $fields));

Upload your template.php file to your active theme folder.

Step 2 of 2

The template.php snippet catches the default user list page layout before it's displayed and looks in the same folder for a profile_listing.tpl.php file which determines the new layout.

A very simple/shortened example of a profile_listing.tpl.php file maybe illustrated as follows....(e.g. I have setup custom extended user profile fields called profile_city, profile_country, profile_postcode)....

<?php if($user->picture): ?>
<div class="picture">
<img src="/<?php print $user->picture ?>">
<?php endif; ?>
<?php profile_load_profile($user->uid) ?>
<div class="custom_profiles">
<div class="fields">Name: <?php print $user->name ?></div>
<div class="fields">City: <?php print $user->profile_city ?></div>
<div class="fields">Country: <?php print $user->profile_country ?></div>
<div class="fields">Postcode: <?php print $user->profile_postcode ?></div>

Upload your profile_listing.tpl.php file to your active theme folder and go to your user list page at to see the new layout.

For Drupal 5.x
It works the same way for Drupal 5, except for the token names used in profile_listing.tpl.php
Here is an example, with custom profile fields :

<table width = "100%" border="0" cellspacing="2" cellpadding="0" align="left">
<tr><td></td><td rowspan=5 valign= "top" align="right"><?php if($user->picture) {print '<br />'.theme('user_picture', $user);} ?></td></tr>

<tr><td>Name : <?php print check_plain($user->profile_Name) ?></td></tr>
<tr><td>Home phone number: <?php print check_plain($user->profile_home_phone) ?></td></tr>
<? if ($user->profile_prefered){ print '<tr><td> Email Address : '.$user->profile_home_email.'</td></tr>'; } ?>
<? if($user->profile_home_address){ print '<tr><td>Home address: '.check_plain($user->profile_home_address).'</td></tr>';} ?>

If also fixes the problem of the link to the user profile, it's on the picture.

You can have a look at this page :
It has been written for Drupal 5 too, it is similar to this one, and can be useful


  • Name the classes or change the layout to whatever you want.
  • Edit your style.css file or whatever your main stylesheet is called to control the the class styles.
  • You can include the user profile page snippets if you like
  • Please post tips/tricks discuss this handbook page at this thread.

Looking for support? Visit the forums, or join #drupal-support in IRC.