You are here

function notifications_form_unsubscribe_confirm in Notifications 6

Same name and namespace in other branches
  1. 5 notifications.admin.inc \notifications_form_unsubscribe_confirm()
  2. 6.4 notifications.pages.inc \notifications_form_unsubscribe_confirm()
  3. 6.2 notifications.pages.inc \notifications_form_unsubscribe_confirm()
  4. 6.3 notifications.pages.inc \notifications_form_unsubscribe_confirm()

Form for unsubscription confirmation

It works for both single subscription or account (all subscriptions)

1 string reference to 'notifications_form_unsubscribe_confirm'
notifications_page_unsubscribe in ./notifications.pages.inc
Menu callback for unsubscribe page

File

./notifications.pages.inc, line 321
User pages for Notifications

Code

function notifications_form_unsubscribe_confirm($form_state, $subscription, $account = NULL) {

  // Pass on subscription values
  $form['subscription'] = array(
    '#type' => 'value',
    '#value' => $subscription,
  );
  $form['account'] = array(
    '#type' => 'value',
    '#value' => $account,
  );
  if ($subscription) {
    $message = t('Are you sure you want to delete this subscription?');

    // The names will be added here
    notifications_module_invoke('names', $subscription);
    $form['info'] = array(
      '#type' => 'item',
      '#title' => t('!type subscription to', array(
        '!type' => $subscription->type_name,
      )),
      '#value' => theme('item_list', $subscription->names),
    );
  }
  else {
    $message = t('Are you sure you want to remove all your subscriptions on this site?');
  }
  return confirm_form($form, $message, isset($_GET['destination']) ? $_GET['destination'] : '', t('This action cannot be undone.'), t('Unsubscribe'), t('Cancel'));
}