You are here

function simplenews_taxonomy in Simplenews 6.2

Same name and namespace in other branches
  1. 5 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 893
Simplenews node handling, sent email, newsletter block and general hooks

Code

function simplenews_taxonomy($op, $type, $term = NULL) {
  if ($op == 'delete' && $term['vid'] == variable_get('simplenews_vid', '')) {
    switch ($type) {
      case 'term':
        db_query('
          DELETE FROM {simplenews_snid_tid}
          WHERE tid = %d', $term['tid']);
        db_query("\n          DELETE FROM {blocks}\n          WHERE module = '%s'\n            AND delta = '%s'", 'simplenews', $term['tid']);
        drupal_set_message(t('All subscriptions to newsletter %newsletter have been deleted.', array(
          '%newsletter' => $term['name'],
        )));
        break;
    }
  }
}