You are here

function notifications_account_form_unsubscribe_confirm_submit in Notifications 7

Process unsubscribe form submission

File

notifications_account/notifications_account.pages.inc, line 307
User pages for Notifications

Code

function notifications_account_form_unsubscribe_confirm_submit($form, &$form_state) {
  $subscription = $form_state['values']['subscription'];
  $account = $form_state['values']['account'];
  switch ($form_state['values']['op']) {
    case t('Unsubscribe'):
      if ($subscription) {
        Notifications_Subscription::delete_subscription($subscription->sid);
        drupal_set_message(t('Your subscription has been removed.'));
      }
      elseif ($account) {
        Notifications_Subscription::delete_multiple(array(
          'uid' => $account->uid,
        ));
        drupal_set_message(t('All your subscriptions have been removed.'));
      }
      $form_state['redirect'] = '';
      break;
    case t('Cancel'):

      // Do nothing, not worth showing a message, just get back
      $form_state['redirect'] = '';
      break;
  }
}