I'm trying to put together a block that will display additional information on users' blog pages. The person I'm working with wants some of the more "traditional" blog stuff, like a user picture, short bio, blogroll, and archives links shown in the sidebar. All of the actual information is supported by other modules, so I just need to be able to access it from within my theme. Essentially, what I'm going for is to load this block whenever the node type is 'blog post', and populate it with the content matching the author of the node.<br>
<br>I am using a small snippet of code that someone else gave me already for displaying a title. This is residing in node-blog.tpl.php right now and works fine:<br><?php $the_user = user_load(array('uid' => $node->uid)); ?>
<br><?php if ($the_user->profile_blog_title != ""): ?>
<br> <h2><?php print $the_user->profile_blog_title ?></h2>
<br> <?php else: ?>
<br> <h2><?php print $node->name . "'s blog" ?></h2>
<br><?php endif; ?><br><br>What I've been using so far in my module's implementation of hook_block looks like this, which is just worrying about the picture for now:<br> case 'view':<br> $block['subject'] = t('Blog');<br>
$the_user = user_load(array('uid' => $node->uid));
<br> $user_pic = $the_user->picture;<br> $block['content'] = $user_pic;<br> return $block;<br><br>However, this does not return anything, and upon further investigation with print_r(), it appears to be returning the anonymous user from 'uid', which of course doesn't have a picture associated with it. Part of what I'm not sure about is whether I can access the node information ($node->uid) from within the block, since it's in the sidebar, not the main content area where the node is loaded. Please excuse me as I'm very new to PHP and Drupal development, but looking to learn.<br clear="all">
<br>-- <br>Tony Yarusso<br><a href="http://tonyyarusso.com/">http://tonyyarusso.com/</a>