You are here

function simplenews_subscription_save in Simplenews 7

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

Save a subscription.

Related topics

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

File

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

Code

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