Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.533
diff -u -p -r1.533 comment.module
--- modules/comment/comment.module	30 Mar 2007 07:45:19 -0000	1.533
+++ modules/comment/comment.module	1 Apr 2007 02:18:27 -0000
@@ -641,7 +641,7 @@ function comment_reply($node, $pid = NUL
           // Display the parent comment
           $comment = drupal_unpack($comment);
           $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
-          $comment->signature = check_markup($comment->signature, $comment->format);
+          $comment->type = $node->type;
           $output .= theme('comment_view', $comment);
         }
         else {
@@ -946,7 +946,7 @@ function comment_render($node, $cid = 0)
 
       if ($comment = db_fetch_object($result)) {
         $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
-        $comment->signature = check_markup($comment->signature, $comment->format);
+        $comment->type = $node->type;
         $links = module_invoke_all('link', 'comment', $comment, 1);
         drupal_alter('link', $links, $node);
 
@@ -1001,7 +1001,7 @@ function comment_render($node, $cid = 0)
       while ($comment = db_fetch_object($result)) {
         $comment = drupal_unpack($comment);
         $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
-        $comment->signature = check_markup($comment->signature, $comment->format);
+        $comment->type = $node->type; 
         $comment->depth = count(explode('.', $comment->thread)) - 1;
 
         if ($mode == COMMENT_MODE_THREADED_COLLAPSED || $mode == COMMENT_MODE_THREADED_EXPANDED) {
@@ -1600,12 +1600,14 @@ function comment_form_add_preview($form,
     if ($account) {
       $comment->uid = $account->uid;
       $comment->name = check_plain($account->name);
-      $comment->signature = check_markup($account->signature, $comment->format);
+      $comment->signature = $account->signature;
     }
     else {
       $comment->name = variable_get('anonymous', t('Anonymous'));
       $comment->signature = '';
     }
+    $node = node_load($comment->nid);
+    $comment->type = $node->type;
     $comment->timestamp = !empty($edit['timestamp']) ? $edit['timestamp'] : time();
     $output .= theme('comment_view', $comment);
   }
@@ -1622,7 +1624,7 @@ function comment_form_add_preview($form,
     $comment = db_fetch_object(db_query('SELECT c.*, u.uid, u.name AS registered_name, u.signature, u.picture, u.data FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = %d AND c.status = %d', $edit['pid'], COMMENT_PUBLISHED));
     $comment = drupal_unpack($comment);
     $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
-    $comment->signature = check_markup($comment->signature, $comment->format);
+    $comment->type = $node->type;
     $output .= theme('comment_view', $comment);
   }
   else {
@@ -1775,8 +1777,11 @@ function theme_comment($comment, $links 
   $output  = '<div class="comment'. ($comment->status == COMMENT_NOT_PUBLISHED ? ' comment-unpublished' : '') .'">';
   $output .= '<div class="subject">'. l($comment->subject, $_GET['q'], array('fragment' => "comment-$comment->cid")) . ' ' . theme('mark', $comment->new) ."</div>\n";
   $output .= '<div class="credit">'. t('by %a on %b', array('%a' => theme('username', $comment), '%b' => format_date($comment->timestamp))) ."</div>\n";
-  $output .= '<div class="body">'. $comment->comment .'</div>';
-  $output .= '<div class="user-signature clear">'. $comment->signature .'</div>';
+  $output .= '<div class="body">'. $comment->comment;
+  if ($signature) {
+    $output .= theme('user_signature', $comment->signature);
+  }
+  $output .= '</div>';
   $output .= '<div class="links">'. theme('links', $links) .'</div>';
   $output .= '</div>';
   return $output;
Index: modules/forum/forum.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.install,v
retrieving revision 1.6
diff -u -p -r1.6 forum.install
--- modules/forum/forum.install	1 Sep 2006 07:40:08 -0000	1.6
+++ modules/forum/forum.install	1 Apr 2007 02:18:27 -0000
@@ -28,6 +28,9 @@ function forum_install() {
       db_query("CREATE INDEX {forum}_tid_idx ON {forum} (tid)");
       break;
   }
+
+  // Turn on signatures.
+  variable_set('user_signature_forum', 1);
 }
 
 /**
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.794
diff -u -p -r1.794 node.module
--- modules/node/node.module	27 Mar 2007 05:13:54 -0000	1.794
+++ modules/node/node.module	1 Apr 2007 02:18:30 -0000
@@ -521,10 +521,10 @@ function node_load($param = array(), $re
   // No db_rewrite_sql is applied so as to get complete indexing for search.
   if ($revision) {
     array_unshift($arguments, $revision);
-    $node = db_fetch_object(db_query('SELECT n.nid, r.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = %d WHERE '. $cond, $arguments));
+    $node = db_fetch_object(db_query('SELECT n.nid, r.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.signature, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = %d WHERE '. $cond, $arguments));
   }
   else {
-    $node = db_fetch_object(db_query('SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid WHERE '. $cond, $arguments));
+    $node = db_fetch_object(db_query('SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.signature, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid WHERE '. $cond, $arguments));
   }
 
   if ($node->nid) {
@@ -2164,6 +2164,7 @@ function node_preview($node) {
       if ($user = user_load(array('name' => $node->name))) {
         $node->uid = $user->uid;
         $node->picture = $user->picture;
+        $node->signature = $user->signature;
       }
       else {
         $node->uid = 0; // anonymous user
@@ -2173,6 +2174,7 @@ function node_preview($node) {
       $user = user_load(array('uid' => $node->uid));
       $node->name = $user->name;
       $node->picture = $user->picture;
+      $node->signature = $user->signature;
     }
 
     // Set the timestamps when needed:
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.763
diff -u -p -r1.763 user.module
--- modules/user/user.module	30 Mar 2007 07:45:19 -0000	1.763
+++ modules/user/user.module	1 Apr 2007 02:18:33 -0000
@@ -1437,17 +1437,20 @@ function user_edit_form($uid, $edit, $re
 
   // Signature:
   if (module_exists('comment') && !$register) {
-    $form['signature_settings'] = array(
-      '#type' => 'fieldset',
-      '#title' => t('Signature settings'),
-      '#weight' => 1,
-    );
-    $form['signature_settings']['signature'] = array(
-      '#type' => 'textarea',
-      '#title' => t('Signature'),
-      '#default_value' => $edit['signature'],
-      '#description' => t('Your signature will be publicly displayed at the end of your comments.'),
-    );
+    $types = user_get_signature_enabled_types();
+    if (!empty($types)) {
+      $form['signature_settings'] = array(
+        '#type' => 'fieldset',
+        '#title' => t('Signature settings'),
+        '#weight' => 1,
+      );
+      $form['signature_settings']['signature'] = array(
+        '#type' => 'textarea',
+        '#title' => t('Signature'),
+        '#default_value' => $edit['signature'],
+        '#description' => t('Your signature will be publicly displayed at the end of your comments.'),
+      );
+    }
   }
 
   // Picture/avatar:
@@ -2773,3 +2776,86 @@ function user_forms() {
   return $forms;
 }
 
+/**
+ * Implementation of hook_form_alter().
+ */
+function user_form_alter(&$form, $form_id) {
+  // Add checkbox for settings to the node type form.
+  if ($form_id == 'node_type_form') {
+    $form['workflow']['user_signature'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Show user signatures for content type.'),
+      '#default_value' => variable_get('user_signature_'. $form['#node_type']->type, 0),
+      '#description' => t("If enabled, users' signatures will be appended to the end of all posts of this type."),
+    );
+  }
+}
+
+/**
+ * Retrieves list of signature-enabled node types.
+ *
+ * @return array
+ *  An array of node type names, e.g. array('forum', 'story')
+ */
+function user_get_signature_enabled_types() {
+  $enabled = array();
+  $types = node_get_types();
+  foreach ($types as $type) {
+    if (variable_get('user_signature_'. $type->orig_type, 0)) {
+      $enabled[] = $type;
+    }
+  }
+  return $enabled;
+}
+
+/**
+ * Implementation of hook_nodeapi().
+ *
+ * Adds a signature property to node if signatures are enabled for
+ * a given node type.
+ */
+function user_nodeapi(&$node, $op, $teaser, $page) {
+  if ($op == 'view' && $page) {
+    if (variable_get('user_signature_'. $node->type, 0)) {
+      $node->signature = check_markup($node->signature, $node->format);
+    }
+    else {
+      $node->signature = '';
+    }
+  }
+}
+
+/**
+ * Implementation of hook_comment().
+ *
+ * Adds a signature property to comments if signatures are enabled for
+ * a given node type.
+ */
+function user_comment($comment, $op) {
+  if ($op == 'view') {
+    if (variable_get('user_signature_'. $comment->type, 0)) {
+      $comment->signature = check_markup($comment->signature, $comment->format);;
+    }
+    else {
+      $comment->signature = '';
+    }
+  }
+}
+
+/**
+ * Theme output of signature.
+ *
+ * @ingroup themeable
+ */
+function theme_user_signature($signature) {
+  $output = '';
+  if ($signature) {
+    $output .= '<div class="clear-block">';
+    $output .= '—';
+    $output .= $signature;
+    $output .= '</div>';
+  }
+
+  return $output;
+}
+
Index: themes/bluemarine/node.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/themes/bluemarine/node.tpl.php,v
retrieving revision 1.5
diff -u -p -r1.5 node.tpl.php
--- themes/bluemarine/node.tpl.php	15 Apr 2006 04:07:17 -0000	1.5
+++ themes/bluemarine/node.tpl.php	1 Apr 2007 02:18:33 -0000
@@ -5,6 +5,12 @@
     <?php if ($page == 0) { ?><h2 class="title"><a href="<?php print $node_url?>"><?php print $title?></a></h2><?php }; ?>
     <span class="submitted"><?php print $submitted?></span>
     <span class="taxonomy"><?php print $terms?></span>
-    <div class="content"><?php print $content?></div>
+    <div class="content">
+      <?php print $content?>
+      <?php if ($signature): ?>
+      —
+      <?php print $signature; ?>
+      <?php endif; ?>
+    </div>
     <?php if ($links) { ?><div class="links">&raquo; <?php print $links?></div><?php }; ?>
   </div>
Index: themes/chameleon/chameleon.theme
===================================================================
RCS file: /cvs/drupal/drupal/themes/chameleon/chameleon.theme,v
retrieving revision 1.57
diff -u -p -r1.57 chameleon.theme
--- themes/chameleon/chameleon.theme	30 Mar 2007 07:45:19 -0000	1.57
+++ themes/chameleon/chameleon.theme	1 Apr 2007 02:18:33 -0000
@@ -134,6 +134,7 @@ function chameleon_node($node, $teaser =
   }
   else {
     $output .= $node->body;
+    $output .= theme('user_signature', $node->signature);
   }
 
   $output .= " </div>\n";
Index: themes/engines/phptemplate/node.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/themes/engines/phptemplate/node.tpl.php,v
retrieving revision 1.4
diff -u -p -r1.4 node.tpl.php
--- themes/engines/phptemplate/node.tpl.php	31 Aug 2006 07:21:43 -0000	1.4
+++ themes/engines/phptemplate/node.tpl.php	1 Apr 2007 02:18:33 -0000
@@ -18,6 +18,10 @@
 
   <div class="content">
     <?php print $content ?>
+    <?php if ($signature && $page): ?>
+    —
+    <?php print $signature; ?>
+    <? endif;?>
   </div>
 
 <?php
Index: themes/engines/phptemplate/phptemplate.engine
===================================================================
RCS file: /cvs/drupal/drupal/themes/engines/phptemplate/phptemplate.engine,v
retrieving revision 1.61
diff -u -p -r1.61 phptemplate.engine
--- themes/engines/phptemplate/phptemplate.engine	30 Mar 2007 07:45:19 -0000	1.61
+++ themes/engines/phptemplate/phptemplate.engine	1 Apr 2007 02:18:34 -0000
@@ -273,6 +273,7 @@ function phptemplate_node($node, $teaser
 
   $variables = array(
     'content'        => $content,
+    'signature'      => $page ? $node->signature : '',
     'date'           => format_date($node->created),
     'links'          => !empty($node->links) ? theme('links', $node->links, array('class' => 'links inline')) : '',
     'name'           => theme('username', $node),
Index: themes/garland/node.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/themes/garland/node.tpl.php,v
retrieving revision 1.1
diff -u -p -r1.1 node.tpl.php
--- themes/garland/node.tpl.php	29 Oct 2006 13:17:38 -0000	1.1
+++ themes/garland/node.tpl.php	1 Apr 2007 02:18:34 -0000
@@ -14,6 +14,10 @@
 
   <div class="content">
     <?php print $content ?>
+    <?php if ($signature): ?>
+    —
+    <?php print $signature; ?>
+    <?php endif; ?>
   </div>
 
   <div class="clear-block clear">
Index: themes/pushbutton/node.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/themes/pushbutton/node.tpl.php,v
retrieving revision 1.2
diff -u -p -r1.2 node.tpl.php
--- themes/pushbutton/node.tpl.php	15 Apr 2006 04:07:18 -0000	1.2
+++ themes/pushbutton/node.tpl.php	1 Apr 2007 02:18:34 -0000
@@ -5,7 +5,12 @@
   <?php endif; ?>
     <span class="submitted"><?php print $submitted ?></span>
     <span class="taxonomy"><?php print $terms ?></span>
-    <div class="content"><?php print $content ?></div>
+    <div class="content">
+      <?php print $content ?>
+      <?php if ($signature): ?>
+      <?php print $signature; ?>
+      <?php endif; ?>
+    </div>
     <?php if ($links): ?>
     <div class="links">&raquo; <?php print $links ?></div>
     <?php endif; ?>
