3

Searching in Google I found user-profile.tpl.php , but in fact this is the node of profile page while I want to create page.tpl.php foe the profile page. Also page-user.tpl.php includes login page, register page and all the pages belong to a user which I do not consider, I need to create page.tpl for profile page

2 Answers 2

4

the best way to handle this that i've come up with is a combination of 4 files:

  • page-user.tpl.php for the far-back profile edit as igor said
  • user-profile.tpl.php for the profile content
  • page-user-register.tpl.php set to match page.tpl.php in order to keep page-user.tpl.php from overriding the register page, and
  • page-user-login.tpl.php set up in the same way as page-user-register for the same reason.
4

Try this...

page--user-profile.tpl.php

[page]--[node].tpl.php

or actually...

page--user.tpl.php

To see available templates for this page simply do the following in your themes template.php

function YOURTHEME_preprocess_page(&$variables) {
   echo '<pre>'; var_dump($variables['theme_hook_suggestions']); echo '</pre>';
}

If nothing were in there (doubtful), then just add your own...

if ($SOME_CONDITION) {
    $variables['theme_hook_suggestions'][] = 'page--user-profile.tpl.php';
}
1
  • 1
    The method of using preprocess and a theme hook suggestion is how I'd do it. +1
    – Beebee
    Dec 5, 2012 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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