Index: comment.module =================================================================== --- comment.module (revision 5268) +++ comment.module (working copy) @@ -392,7 +392,12 @@ function comment_nodeapi(&$node, $op, $arg = 0) { switch ($op) { case 'load': - return db_fetch_array(db_query("SELECT last_comment_timestamp, last_comment_name, comment_count FROM {node_comment_statistics} WHERE nid = %d", $node->nid)); + if ($node->comment != COMMENT_NODE_DISABLED) { + return db_fetch_array(db_query("SELECT last_comment_timestamp, last_comment_name, comment_count FROM {node_comment_statistics} WHERE nid = %d", $node->nid)); + } + else { + return array('last_comment_timestamp' => $node->created, 'last_comment_name' => '', 'comment_count' => 0); + } break; case 'prepare': @@ -412,15 +417,23 @@ case 'update index': $text = ''; - $comments = db_query('SELECT subject, comment, format FROM {comments} WHERE nid = %d AND status = %d', $node->nid, COMMENT_PUBLISHED); - while ($comment = db_fetch_object($comments)) { - $text .= '