You are here

function simplenews_delete_subscription in Simplenews 6.2

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

Delete every subscription for the given subscription ID.

Parameters

integer $snid subscription id:

1 call to simplenews_delete_subscription()
simplenews_subscription_multiple_delete_confirm_submit in includes/simplenews.admin.inc

File

./simplenews.module, line 1691
Simplenews node handling, sent email, newsletter block and general hooks

Code

function simplenews_delete_subscription($snid) {
  $account = db_fetch_object(db_query('
    SELECT mail
    FROM {simplenews_subscriptions}
    WHERE snid = %d', $snid));
  db_query('
    DELETE FROM {simplenews_subscriptions}
    WHERE snid = %d', $snid);
  db_query('
    DELETE FROM {simplenews_snid_tid}
    WHERE snid = %d', $snid);
  watchdog('simplenews', 'User %email deleted from the mailing list.', array(
    '%email' => $account->mail,
  ), WATCHDOG_NOTICE);
}