By queequeg on
I've been editing page-user.tpl.php and user-profile.tpl.php in order to customize the way the user profiles look. From within user-profile.tpl.php, the user's profile information is locally available in the $account object, but on the user-profile.tpl.php, it's not available.
i've been stumped on this for a few days ... basically i want to get the account info at a higher level, on the page template. So that on the tracker, contact, etc pages (all of which are displayed through page-user.tpl.php) i can show some of the users' stuff.
All that seems available at this level is the $content variable which is useless to me.
any help please!
thanks
~q
Comments
I'm a little slow today, but
I'm a little slow today, but I think this is what you're trying to accomplish:
//put this at the top of page-user.tpl.php
profile_load_profile($account);
then you can see the object by:
print_r($account);
If you're extending the profile with the profile module you can use:
print_r($profile);
or of course the user object by:
print_r($user);
Nope that doesn't work but what about this!
no, that doesn't work as i explained $account and $profile are not within the scope of PAGE-user-tpl.php. At this level only the string $content is available, and that has HTML which has been generated by user-profile.tpl.php.
Why I want to do this? because I want all the user related pages to be customized with the user information (ie contact, tracker, profiles, etc) BEFORE the template spits out the $content variable. I want all the user profile information from the very beginning of the page! Unless I screwed up my drupal theme, it's not working out this way.
I came up with this solution based on the URI that is being accessed, in order to get the user object and grab the user's picture as an example. I Think it will work, but it seems like such a hack solution. The user is already being totally loaded up by the template that comes right after this one, i shouldn't have to load it up twice, right? I just dont know where to look for where the user is actually loaded up here and make it global across ALL of the user pages.
that's what i came up with, any suggestions to make it better? thx
~q
Very strange. I have a dev
Very strange. I have a dev copy of a profile page I'm currently working on. Hopefully it lends something to what you're trying to accomplish. Otherwise, I'm out of ideas (still slow today, got a bad cold lol).
user-profile.tpl.php
I take it by using 'page-user.tpl.php' that you'd like a separate style entirely for the page?
If not, use this snippet in your theme.php. This adds template suggestions for nodes
this is not helpful at all.
this is not helpful at all.
what i am seeing is that from the scope of PAGE, there is no connection to the NODE contained within it, which is just printed out in the $CONTENT variable.
THAT is my problem.
The same thing goes for NODE EDIT pages:
I have a scenario where the NODE includes the ability for the user to select a custom layout for the page (gray, black, or white). This needs to be available at the PAGE level in order to have the correct CSS file placed into the head.
in more detailed words ... the user creates a project. the project includes gray/white/black template options for the entire page. Problem is, when the user PREVIEWS their project, the NODE is not available to the PAGE-NODE-EDIT.TPL.PHP file. Nor are the $_POST variables, which is also strange and very annoying.
so when they're previewing their post. they need to be able to see the template in action. That the vaiable is available on the NODE level of the template is useless to me, I need it to be available at the PAGE level.
PLEASE PLEASE PLEASE if anyone knows how to do this let me know. I DONT want to install yet another module. This information ought to be available directly via php.
thank you