You are here

function simplenews_old_confirm_subscription in Simplenews 7.2

Backwards compatibility for old conformation links.

1 string reference to 'simplenews_old_confirm_subscription'
simplenews_menu in ./simplenews.module
Implements hook_menu().

File

includes/simplenews.subscription.inc, line 792
(Un)subscription and (un)subscription confirmation

Code

function simplenews_old_confirm_subscription($action, $hash) {
  $subscriber = simplenews_subscriber_load_by_hash($hash);
  if ($subscriber) {

    // Extract the newsletter id.
    list(, $newsletter_id) = explode('t', drupal_substr($hash, 10));
    switch ($action) {
      case 'add':
      case 'remove':
        $context = array(
          'simplenews_subscriber' => $subscriber,
          'newsletter' => simplenews_newsletter_load($newsletter_id),
        );
        $token = $action == 'add' ? 'subscribe' : 'unsubscribe';
        return drupal_get_form('simplenews_request_hash', $token, $context);
        break;
      case 'combined':
        if (!empty($subscriber->changes)) {
          $context = array(
            'simplenews_subscriber' => $subscriber,
          );
          return drupal_get_form('simplenews_request_hash', 'subscribe_combined', $context);
        }
        break;
    }
  }
  return MENU_NOT_FOUND;
}