You are here

function disqus_node_insert in Disqus 7

Implements hook_node_insert().

1 call to disqus_node_insert()
disqus_node_update in ./disqus.module
Implements hook_node_update().

File

./disqus.module, line 373
The Disqus Drupal module.

Code

function disqus_node_insert($node) {
  if (isset($node->disqus_status)) {

    // This insert hook can also be called from disqus_node_update() and an
    // entry for a given nid could already exist at the time. Let's use merge
    // query to prevent duplicate entries.
    db_merge('disqus')
      ->key(array(
      'nid' => $node->nid,
    ))
      ->fields(array(
      'nid' => $node->nid,
      'status' => $node->disqus_status,
    ))
      ->execute();
  }
}