comment_user

  1. drupal
    1. 4.7
    2. 5 comment.module
    3. 6 comment.module
Versions
4.7 – 6 comment_user($type, $edit, &$user, $category = NULL)

Implementation of hook_user().

Provides signature customization for the user's comments.

Code

modules/comment.module, line 320

<?php
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') {
    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);
  }
}
?>