You are here

function simplenews_subscription_save in Simplenews 7.2

Same name and namespace in other branches
  1. 7 simplenews.module \simplenews_subscription_save()

Save a subscription.

Related topics

2 calls to simplenews_subscription_save()
simplenews_subscribe in ./simplenews.module
Subscribe a user to a newsletter or send a confirmation mail.
simplenews_unsubscribe in ./simplenews.module
Unsubscribe a user from a mailing list or send a confirmation mail.

File

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

Code

function simplenews_subscription_save($subscription) {
  db_merge('simplenews_subscription')
    ->key(array(
    'newsletter_id' => $subscription->newsletter_id,
  ))
    ->key(array(
    'snid' => $subscription->snid,
  ))
    ->fields(array(
    'snid' => $subscription->snid,
    'newsletter_id' => $subscription->newsletter_id,
    'status' => $subscription->status,
    'timestamp' => $subscription->timestamp,
    'source' => $subscription->source,
  ))
    ->execute();
}