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 15:53:55 -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.659
diff -u -F^f -r1.659 user.module
--- modules/user/user.module	20 Aug 2006 13:16:34 -0000	1.659
+++ modules/user/user.module	20 Aug 2006 15:53:58 -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);
@@ -2563,9 +2579,56 @@ 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_form_alter().
+ */
+function user_form_alter($form_id, &$form) {
+  if ($form_id == 'comment_form') {
+    $form['#submit'] = array_merge(array('user_signature_append' => array('comment')), $form['#submit']);
+  }
+  elseif (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id && variable_get("comment_$node->type", 2)) {
+    $form['#submit'] = array_merge(array('user_signature_append' => array('post')), $form['#submit']);
+  }
+}
+
+/**
+ * Form submit callback; append user signature to new post or comment.
+ *
+ * @param $type
+ *   Which type of signature is being appended; 'post' or 'comment'.
+ */
+function user_signature_append($form_id, &$form_values, $type) {
+  if ($type == 'comment') {
+    if (empty($form_values['cid'])) {
+      $author = user_load(array('name' => $form_values['author']));
+      $form_values['comment'] .= theme('user_signature', $author->signature);
+    }
+  }
+  elseif ($type == 'post') {
+    if (empty($form_values['nid'])) {
+      $author = user_load(array('uid' => $form_values['uid']));
+      $form_values['body'] .= theme('user_signature', $author->signature);
+    }
+  }
+}
+
+/**
+ * Output a user's signature.
+ *
+ * @ingroup themeable
+ */
+function theme_user_signature($signature) {
+  $output = "
+<div class=\"user_signature clear\">
+-- 
+$signature
+</div>
+";
+  return $output;
+}
