function comment_user in Drupal 4
Same name and namespace in other branches
- 5 modules/comment/comment.module \comment_user()
- 6 modules/comment/comment.module \comment_user()
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);
}
}