function comment_node_insert

Implements hook_node_insert().

File

modules/comment/comment.module, line 1311

Code

function comment_node_insert($node) {
    // Allow bulk updates and inserts to temporarily disable the
    // maintenance of the {node_comment_statistics} table.
    if (variable_get('comment_maintain_node_statistics', TRUE)) {
        db_insert('node_comment_statistics')->fields(array(
            'nid' => $node->nid,
            'cid' => 0,
            'last_comment_timestamp' => $node->changed,
            'last_comment_name' => NULL,
            'last_comment_uid' => $node->uid,
            'comment_count' => 0,
        ))
            ->execute();
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.