summaryrefslogtreecommitdiff
path: root/modules/comment/comment.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/comment/comment.module')
-rw-r--r--modules/comment/comment.module25
1 files changed, 9 insertions, 16 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 0df7c1f13..b47ace8f8 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -278,7 +278,6 @@ function comment_form_alter($form_id, &$form) {
}
elseif (isset($form['type'])) {
if ($form['type']['#value'] .'_node_form' == $form_id) {
- $form['#submit']['comment_node_submit'] = array();
$node = $form['#node'];
$form['comment_settings'] = array(
'#type' => 'fieldset',
@@ -296,10 +295,6 @@ function comment_form_alter($form_id, &$form) {
);
}
}
-
- if ($form_id == 'node_delete_confirm') {
- $form['#submit']['comment_node_delete_confirm_submit'] = array();
- }
}
/**
@@ -318,6 +313,15 @@ function comment_nodeapi(&$node, $op, $arg = 0) {
}
break;
+ case 'insert':
+ db_query('INSERT INTO {node_comment_statistics} (nid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) VALUES (%d, %d, NULL, %d, 0)', $node->nid, $node->created, $node->uid);
+ break;
+
+ case 'delete':
+ db_query('DELETE FROM {comments} WHERE nid = %d', $node->nid);
+ db_query('DELETE FROM {node_comment_statistics} WHERE nid = %d', $node->nid);
+ break;
+
case 'update index':
$text = '';
$comments = db_query('SELECT subject, comment, format FROM {comments} WHERE nid = %d AND status = %d', $node->nid, COMMENT_PUBLISHED);
@@ -340,17 +344,6 @@ function comment_nodeapi(&$node, $op, $arg = 0) {
}
}
-function comment_node_delete_confirm_submit($form_id, $form_values) {
- db_query('DELETE FROM {comments} WHERE nid = %d', $form_values['node']->nid);
- db_query('DELETE FROM {node_comment_statistics} WHERE nid = %d', $form_values['node']->nid);
-}
-
-function comment_node_submit($form_id, $node) {
- if ($node->is_new) {
- db_query('INSERT INTO {node_comment_statistics} (nid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) VALUES (%d, %d, NULL, %d, 0)', $node->nid, $node->created, $node->uid);
- }
-}
-
/**
* Implementation of hook_user().
*