I am Steve Krueger.

I am a graphic designin', drupal developin', open-sourcin', content managin', front-end programmin', tech-geek bloggin', freelancin', rock climbin', Vancouver lovin' computer geek. I'm sure I have more to say about myself but would rather get to know you. Get in contact with me to see what I can do for you.

Add Block Regions to your User Profile page in Drupal 5 and 6

18
Aug
2008

Here's a small snippet to allow the output of blocks in your user profiles. This is assuming that you are currently over-riding the user page with the following code:

Update!

I've added code for both Drupal 5 and 6, take a look.

Drupal 5

<?php
/**
* Catch the theme_user_profile function, and redirect through the template api
*/
function phptemplate_user_profile($user, $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.
  /* potential need for other code to extract field info */
return _phptemplate_callback('user_profile', array('user' => $user, 'fields' => $fields));
  }
?>

(Code from: http://drupal.org/node/35728 )

and have your user_profile.tpl.php named as so.

Settings up your block regions:

First we'll slip into our theme's template.php file and make sure we create a new region.