Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.477
diff -u -F^f -r1.477 comment.module
--- modules/comment/comment.module	19 Aug 2006 21:40:58 -0000	1.477
+++ modules/comment/comment.module	20 Aug 2006 09:17:18 -0000
@@ -359,22 +359,7 @@ function comment_nodeapi(&$node, $op, $a
  * Provides signature customization for the user's comments.
  */
 function comment_user($type, $edit, &$user, $category = NULL) {
-  if ($type == 'form' && $category == 'account') {
-    // when user tries to edit his own data
-    $form['comment_settings'] = array(
-      '#type' => 'fieldset',
-      '#title' => t('Comment settings'),
-      '#collapsible' => TRUE,
-      '#weight' => 4);
-    $form['comment_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.'));
-
-    return $form;
-  }
-  elseif ($type == 'delete') {
+  if ($type == 'delete') {
     db_query('UPDATE {comments} SET uid = 0 WHERE uid = %d', $user->uid);
     db_query('UPDATE {node_comment_statistics} SET last_comment_uid = 0 WHERE last_comment_uid = %d', $user->uid);
   }
@@ -1397,7 +1382,7 @@ function comment_form($edit, $title = NU
     $form['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#maxlength' => 64, '#default_value' => $edit['subject']);
   }
 
-  $form['comment_filter']['comment'] = array('#type' => 'textarea', '#title' => t('Comment'), '#rows' => 15, '#default_value' => $edit['comment'] ? $edit['comment'] : $user->signature, '#required' => TRUE);
+  $form['comment_filter']['comment'] = array('#type' => 'textarea', '#title' => t('Comment'), '#rows' => 15, '#default_value' => $edit['comment'], '#required' => TRUE);
   $form['comment_filter']['format'] = filter_form($edit['format']);
 
   $form['cid'] = array('#type' => 'value', '#value' => $edit['cid']);
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.657
diff -u -F^f -r1.657 user.module
--- modules/user/user.module	20 Aug 2006 05:57:41 -0000	1.657
+++ modules/user/user.module	20 Aug 2006 09:17:20 -0000
@@ -1314,6 +1314,22 @@ function user_edit_form($uid, $edit, $re
     }
   }
 
+  // Signature:
+  foreach (node_get_types() as $type => $details) {
+    $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 posts and comments.'),
+    );
+    break;
+  }
+
   // Picture/avatar:
   if (variable_get('user_pictures', 0)) {
     $form['picture'] = array('#type' => 'fieldset', '#title' => t('Picture'), '#weight' => 1);
@@ -2555,9 +2571,51 @@ function user_filter_form_submit($form_i
 
 
 function user_forms() {
-  $forms['user_admin_access_add_form']['callback'] = 'user_admin_access_form';+
+  $forms['user_admin_access_add_form']['callback'] = 'user_admin_access_form';
   $forms['user_admin_access_edit_form']['callback'] = 'user_admin_access_form';
   $forms['user_admin_new_role']['callback'] = 'user_admin_role';
   return $forms;
 }
 
+/**
+ * Implementation of hook_nodeapi().
+ *
+ * Append signatures to signature-enabled node types.
+ */
+function user_nodeapi(&$node, $op, $arg = 0) {
+  if ($op == 'insert') {
+    if (variable_get("comment_$node->type", 2)) {
+      $author = user_load(array('uid' => $node->uid));
+      db_query("UPDATE {node_revisions} SET body = '%s' WHERE nid = %d AND vid = %d", $node->body . theme('user_signature', check_markup($author->signature, $node->format)), $node->nid, $node->nid);
+    }
+  }
+}
+
+/**
+ * Implementation of hook_comment().
+ *
+ * Append signatures to comments, if the parent node type is signature-enabled.
+ */
+function user_comment(&$comment, $op) {
+  if ($op == 'insert') {
+    // Display signatures on insert
+    $node = node_load($comment['nid']);
+    $author = user_load(array('name' => $comment['author']));
+    db_query("UPDATE {comments} SET comment = '%s' WHERE cid = %d", $comment['comment'] . theme('user_signature', check_markup($author->signature, $comment['format'])), $comment['cid']);
+  }
+}
+
+/**
+ * Output a user's signature.
+ *
+ * @ingroup themeable
+ */
+function theme_user_signature($signature) {
+  $output = "
+<div class=\"user_signature clear\">
+-- 
+$signature
+</div>
+";
+  return $output;
+}
