You are here

function simplenews_action_taxonomy in Simplenews 6.2

Implementation of hook_taxonomy().

Deletes actions related to newsletter when it is deleted (term deleted).

File

simplenews_action/simplenews_action.module, line 350
Provide actions for simplenews.

Code

function simplenews_action_taxonomy($op, $type, $term = NULL) {
  if ($op == 'delete' && $term['vid'] == variable_get('simplenews_vid', '')) {
    switch ($type) {
      case 'term':
        $result = db_query("\n          SELECT aid, parameters FROM {actions}\n          WHERE callback IN ('simplenews_subscribe_user_action', 'simplenews_unsubscribe_user_action')\n        ");
        while ($action = db_fetch_object($result)) {
          $parameters = unserialize($action->parameters);
          if ($parameters['tid'] == $term['tid']) {
            actions_delete($action->aid);
          }
        }
        break;
    }
  }
}