You are here

function newsletter_confirm in Newsletter 7

Confirms a subscription to a newsletter list.

1 string reference to 'newsletter_confirm'
newsletter_menu in ./newsletter.module
Implements hook_menu().

File

includes/newsletter.pages.inc, line 162
Functions and forms for the frontend part of newsletter module.

Code

function newsletter_confirm($subscriber) {
  if ($subscriber && !$subscriber->confirmed) {
    $subscriber->confirmed = 1;
    $subscriber->confirmation_timestamp = REQUEST_TIME;
    entity_get_controller('newsletter_subscriber')
      ->save($subscriber);
    if (variable_get('newsletter_send_welcome', FALSE)) {
      newsletter_create()
        ->sendBasic(2, $subscriber->email);
    }
    return t('You have successfully confirmed your subscription!');
  }
  return t('The hash you provided is invalid or outdated');
}