Hi,

I'm theming a blog. I want to put the blog writer's picture at the top of the page. The node template has got a picture variable to do this, but the node template repeats for each blog entry and i don't want the writer's picture displayed more than once. So, i need to spit out the picture variable from the page.tpl.php.

Any ideas?! Thanks

Comments

AjK’s picture

This may be of use to you for pushing variables into various templates:- http://drupal.org/node/16383

nevets’s picture

This snippet should do the trick

<?php
global $user;

print theme('user_picture', $user);
?>
patricktroughton’s picture

Thanks, that's a stroke of genius!! But how would i get the blog author's picture rather than the currently logged in user's picture?

nevets’s picture

This snippet works when viewing pages with a path of the form 'blog/#', where # is the user id of the blog being viewed.

if ( arg(0) == 'blog' && is_numeric(arg(1)) ) {
  // We only get here if viewing a blog and the 2nd argument is a number
  //  Load the account information for the person who's blog is being viewed
  $account = user_load(array('uid' => arg(1)));
  // And theme and print their picture.
  print theme('user_picture', $account);
}