overiding profile with user_profile.tpl.php

mcvegan - July 19, 2008 - 19:58

Hello people, i already working for a while with drupal. But i never really worked with the template.php file to overiding other parts of drupal. But right now, i have to do this because i working on a social network page, such as myspace.com.

So i found the document where they explain how to do this: http://drupal.org/node/16011

I already had a template file, so i pasted the code in this code in the template.php file.

/**
* Catch the theme_profile_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));
  }

After i had done this, i made a user_profile.tpl.php file where i added the this code:

<?php if($user->picture): ?>
<div class="picture">
<img src="/<?php print $user->picture ?>">
</div>
<?php endif; ?>
/** If you are using this snippet with Drupal version 4.7.x or 5.x use the
* following line to display a user picture instead
* <?php  if($user->picture) {print theme('user_picture', $user);}?>
*/

<div class="custom_profiles">
<div class="fields">City: <?php print check_plain($user->profile_city); ?></div>
<div class="fields">Country: <?php print check_plain($user->profile_country) ;?></div>
<div class="fields">Postcode: <?php print check_plain($user->profile_postcode); ?></div>
</div>

I have done everything exactly as explained in the document. I get no errors or something like that, but when i go to "My account" the normal profile seems to show up. And not the user_profile.tpl.php file.

I have try'd almost everything, i readed the document 100 times and searched on drupall.org but i could not find the answer for my problem.

I hope i have given enough information and that some one know maybe what i have done wrong.

Greets,
Mcvegan.

[Edited to fix code tags and moved to a non depreciated forum: nevets]

Well i guess some thing went

mcvegan - July 19, 2008 - 20:03

Well i guess some thing went go wrong when i posted this question. I used [ instead of <, and i can't find out where the edit link is. So i`m sorry about the mess i made already ;)

Greets,
Mcvegan.

First...

yelvington - July 19, 2008 - 20:32

Note that you posted in a forum marked as deprecated.

Since you are working with Drupal 6, begin by reading the theme developer guide (Drupal 6)and then read the api.drupal.org page for user_profile.tpl.php.

The reference is for pre

nevets - July 19, 2008 - 20:33

The reference is for pre Drupal 6, for Drupal 6 I think you want to look at http://drupal.org/node/173880

Thank you guys, Right now i

mcvegan - July 19, 2008 - 21:24

Thank you guys, Right now i use the user-profile.tpl.php in the modules/user/ directory, and this works fine for me :)

Again, thank you!

 
 

Drupal is a registered trademark of Dries Buytaert.