You are here

function simplenews_taxonomy in Simplenews 6

Same name and namespace in other branches
  1. 5 simplenews.module \simplenews_taxonomy()
  2. 6.2 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 689
Simplnews 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':

        //TODO subscriber is not deleted when last subscription is removed.
        db_query('DELETE FROM {simplenews_snid_tid} WHERE tid = %d', $term['tid']);
        db_query("DELETE FROM {blocks} WHERE module = '%s' AND delta = '%s'", 'simplenews', $term['tid']);
        drupal_set_message(t('All subscriptions to newsletter %newsletter have been deleted.', array(
          '%newsletter' => $term['name'],
        )));
        break;
    }
  }
}