You are here

function simplenews_get_subscription in Simplenews 5

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

API function; returns the subscription for the given subscription ID.

3 calls to simplenews_get_subscription()
simplenews_admin_users_delete in ./simplenews.module
Forms API callback; delete user subscription form. Form to delete user from all newsletters.
simplenews_get_user_subscription in ./simplenews.module
API function; returns the subscription for the given e-mail address.
simplenews_subscription_manager_form in ./simplenews.module
Generates the subscription form for users.

File

./simplenews.module, line 900

Code

function simplenews_get_subscription($snid) {
  $subscription = db_fetch_object(db_query("SELECT * FROM {simplenews_subscriptions} s WHERE s.snid = %d", $snid));
  if ($subscription) {
    $result = db_query("SELECT tid FROM {simplenews_snid_tid} t WHERE t.snid = %d", $subscription->snid);
    $subscription->tids = array();
    while ($newsletter = db_fetch_object($result)) {
      $subscription->tids[$newsletter->tid] = $newsletter->tid;
    }
    return $subscription;
  }
  else {
    return FALSE;
  }
}