You are here

function notifications_account_update_subscriptions in Notifications 7

Bulk update all user subscriptions, confirmation form

Parameters

$account: User account

$operation: Operation to perform: enable, disable

File

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

Code

function notifications_account_update_subscriptions($form_state, $account, $operation) {
  $form['account'] = array(
    '#type' => 'value',
    '#value' => $account,
  );
  $form['operation'] = array(
    '#type' => 'value',
    '#value' => $operation,
  );
  $destination = 'user/' . $account->uid . '/notifications';
  $form['#redirect'] = $destination;
  if ($operation == 'enable') {
    return confirm_form($form, t('Are you sure you want to enable all your subscriptions?'), $destination, t('You will get notifications again for all of them.'), t('Enable'), t('Cancel'));
  }
  elseif ($operation == 'disable') {
    return confirm_form($form, t('Are you sure you want to disable all your subscriptions?'), $destination, t('You will stop getting notifications until you enable them again.'), t('Disable'), t('Cancel'));
  }
  else {
    drupal_access_denied();
  }
}