Blog author information

  1. <?php
  2. // $Id$
  3.  
  4. /**
  5.  * @file
  6.  * Implements block for showing archives, user picture, and links for blog sidebars.
  7.  */
  8.  
  9. function blog_sidebar_block($op = 'list', $delta = 0, $edit = array()) {
  10.         switch ($op) {
  11.                
  12.                 case 'list':
  13.                         $blocks[0]['info'] = t('Additional blog information');
  14.                         return $blocks;
  15.                
  16.                 case 'view':
  17.                         if (arg(0) == 'node' && is_numeric(arg(1))) {
  18.                                 $node = node_load(array('nid' => arg(1)));
  19.                                 if ($node->type == 'blog') {
  20.                                         $author = user_load(array('uid' => $node->uid));
  21.                                         $block['subject'] = t('About the author');
  22.                                         $block['content'] = $node->type . theme('bloginfo', $author); // do whatever you want to create the content of your block using $node and $author
  23.                                                 // ...
  24.  
  25.                                         return $block;
  26.                                 }
  27.                                 else {
  28.                                         $author = user_load(array('uid' => $node->uid));
  29.                                         $block['subject'] = t('Type error');
  30.                                         $block['content'] = $node->type;
  31.                                         return $block; // you want to make sure this block is not displayed on other pages.
  32.                                 }
  33.                         }
  34.         }
  35. }
  36.  
  37. function theme_bloginfo($author) {
  38.         $user_pic = $base_path . $author->picture;
  39.         return '<img src="http://localhost/' . $user_pic . '">';
  40. }