--- blog.module	2005-08-14 17:33:26.000000000 -0500
+++ modified_blog.module	2006-01-02 08:02:32.000000000 -0600
@@ -270,19 +270,89 @@
 /**
  * Implementation of hook_block().
  *
- * Displays the most recent 10 blog titles.
+ * Block 0: Displays the most recent 10 blog titles.
+ * Block 1: Displays the most recent 10 blog comment titles.
+ * 
  */
 function blog_block($op = 'list', $delta = 0) {
-  global $user;
+  
   if ($op == 'list') {
     $block[0]['info'] = t('Recent blog posts');
+    $block[1]['info'] = t('Recent blog comments');
     return $block;
   }
-  else if ($op == 'view') {
-    if (user_access('access content')) {
-      $block['content'] = node_title_list(db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, 10));
-      $block['content'] .= '<div class="more-link">'. l(t('more'), 'blog', array('title' => t('Read the latest blog entries.'))) .'</div>';
-      $block['subject'] = t('Recent blog posts');
+  else if ($op == 'view' && user_access('access content')) {
+    switch($delta) {
+      case 0:
+          $block['content'] = node_title_list(db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, 10));
+          $block['content'] .= '<div class="more-link">'. l(t('more'), 'blog', array('title' => t('Read the latest blog entries.'))) .'</div>';
+          $block['subject'] = t('Recent blog posts');
+          break;
+
+      case 1:      
+        $q = explode('/', $_GET['q']);
+
+        if ($q[0] == 'blog') {
+          if(is_numeric($q[1])) {
+            $uid = $q[1];
+            $account = user_load(array('uid' => $uid, 'status' => 1));
+          } else {
+            break;
+          }
+          
+          $result = db_query_range(db_rewrite_sql("SELECT c.nid, c.* 
+                                                    FROM {comments} c 
+                                                    INNER JOIN {node} n ON c.nid = n.nid
+                                                    INNER JOIN {users} u ON n.uid = u.uid 
+                                                    WHERE c.status = 0 
+                                                    AND u.uid = $uid
+                                                    AND n.status = 1
+                                                    AND n.type = 'blog'
+                                                    ORDER BY c.timestamp DESC", 'c'), 0, 10);
+          $items = array();
+
+          while ($comment = db_fetch_object($result)) {
+            $items[] = l($comment->subject, 'node/'. $comment->nid, NULL, NULL, 'comment-'. $comment->cid) .'<br />'. t('%time ago', array('%time' => format_interval(time() - $comment->timestamp)));
+          }
+          
+          if(count($items)) {
+            $block['subject'] = t($account->name . '\'s blog comments');
+            $block['content'] = theme('item_list', $items);
+          }
+
+          break;
+        } 
+        else if ($q[0] == 'node') {
+          if(is_numeric($q[1])) {
+            $nid = $q[1];
+          } else {
+            break;
+          }
+
+          $node = node_load (array('nid'=>$nid));
+          $account = user_load(array('uid' => $node->uid, 'status' => 1));
+
+          $result = db_query_range(db_rewrite_sql("SELECT c.nid, c.* 
+                                                    FROM {comments} c 
+                                                    INNER JOIN {node} n ON c.nid = n.nid
+                                                    INNER JOIN {users} u ON n.uid = u.uid 
+                                                    WHERE c.status = 0 
+                                                    AND u.uid = '$node->uid'
+                                                    AND n.status = 1
+                                                    AND n.type = 'blog'
+                                                    ORDER BY c.timestamp DESC", 'c'), 0, 10);
+          $items = array();
+          while ($comment = db_fetch_object($result)) {
+            $items[] = l($comment->subject, 'node/'. $comment->nid, NULL, NULL, 'comment-'. $comment->cid) .'<br />'. t('%time ago', array('%time' => format_interval(time() - $comment->timestamp)));
+          }
+
+          if(count($items)) {
+            $block['subject'] = t($account->name . '\'s blog comments');
+            $block['content'] = theme('item_list', $items);
+          }
+
+          break;
+        }
     }
     return $block;
   }
