comment_user

5 comment.module comment_user($type, $edit, &$user, $category = NULL)
6 comment.module comment_user($type, $edit, &$user, $category = NULL)

Implementation of hook_user().

Provides signature customization for the user's comments.

File

modules/comment.module, line 319
Enables users to comment on published content.

Code

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);
  }
}
Login or register to post comments