You are here

function simplenews_statistics_node_delete in Simplenews Statistics 7

Same name and namespace in other branches
  1. 7.2 simplenews_statistics.module \simplenews_statistics_node_delete()

Implements hook_node_delete().

File

./simplenews_statistics.module, line 114
Main simplenews statistics file.

Code

function simplenews_statistics_node_delete($node) {
  if ($node->type == 'simplenews') {

    // Delete all open and click records for this newsletter.
    simplenews_statistics_delete_opens($node->nid);
    simplenews_statistics_delete_clicks($node->nid);

    // Delete corresponding record from {simplenews_statistics} table.
    db_delete('simplenews_statistics')
      ->condition('nid', $node->nid)
      ->execute();
  }
}