You are here

function simplenews_taxonomy in Simplenews 5

Same name and namespace in other branches
  1. 6.2 simplenews.module \simplenews_taxonomy()
  2. 6 simplenews.module \simplenews_taxonomy()

Implementation of hook_taxonomy().

Deletes subscriptions to term when term is deleted, and cleans the blocks table.

File

./simplenews.module, line 485

Code

function simplenews_taxonomy($op, $type, $array = NULL) {
  if ($type == 'term' && $op == 'delete' && $array['vid'] == variable_get('simplenews_vid', '')) {
    db_query('DELETE FROM {simplenews_snid_tid} WHERE tid = %d', $array['tid']);
    db_query("DELETE FROM {blocks} WHERE module = '%s' AND delta = '%s'", 'simplenews', 'newsletter-' . $array['tid']);
    drupal_set_message(t('Deleted all subscriptions to newsletter %newsletter.', array(
      '%newsletter' => $array['name'],
    )));
  }
  elseif ($op == 'delete' && $type == 'vocabulary' && $array['vid'] == variable_get('simplenews_vid', '')) {
    variable_del('simplenews_vid');
  }
}