I´ve created a file user-profile.tpl.php in a Drupal 7 installation. I´ve updated the site from Drupal 6. I have old core profile fields and I´ve installed the new profile2 module.

I´ve inserted that user-profile file into my theme folder and flushed cache. I want the profile to show all the core profile fields and the new profile 2 fields.

The thing is that it won´t show any field at all. It just shows the user picture.

After a lot of trying and error, I´ve tried deleting all the content inside user-profile.tpl.php file, and adding into it just "hello world". It won´t be printed out. And the profile picture is still there.

So, how do I get the file to be recognized? Should I set something at my template.tpl.php file?

Thanks for your help!!


  • Any time you add a new template file you need to clear Drupal's cache...have you done that? – Clive Jan 13 '13 at 10:48
  • Thanks for your reply. Yes, I´ve flushed cache, several times. – Rosamunda Jan 13 '13 at 11:15
  • May you show the code you are using in your user-profile.tpl.php file? – kiamlaluno Jan 13 '13 at 17:04
  • Thanks for your reply. I´ve deleted all the content inside user-profile.tpl.php file, and adding into it just the text "hello world". It won´t be printed out. And the profile picture is still there. – Rosamunda Jan 14 '13 at 3:01
  • try disabling Display Suite Module. – user17312 May 8 '13 at 12:24

You could try adding your content in the user profile template preprocess function instead.

e.g, in template.php:

 * Implements hook_preprocess_user_profile
function THEMENAME_preprocess_user_profile(&$variables) {
  // Fetch relevant user account
  $account = $variables['elements']['#account'];
  // Add content to user profile render array
  $variables['user_profile'][] = array(
    '#type' => 'markup', 
    '#markup' => 'Hello world'

After adding a new preprocess function, clear theme registry cache, e.g at Admin > Performance > Clear all caches

| improve this answer | |
  • Thanks for your reply David! I´ve tried that (and flushed cache after it), and it still won´t show up. it´s pretty weird. – Rosamunda Jan 13 '13 at 11:20

After adding content to user profile template preprocess function,to display it on user profile page, you need to render that content. I recently had the same issue. So I created the preprocess function inside my theme's template.php file as suggested by David Thomas and created a user-profile.tpl.php file (just copy the user-profile.tpl.php from User module) inside my theme's template folder and rendered whatever content I wanted to display. In your case it should be something like:

print render($user_profile['content_name']);

Hope that works for you!

| improve this answer | |

It must be possible to print anything when you have properly reckognized user-profile.tpl.php.

In my case it works out of the box. If i delete content of whole file, and just type "test" in it, page shows only "test".

Try this: Make sure that your user-profile.tpl.php is in /templates sub directory, not in root of your template folder, otherwise it won't work!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.