You are here

function notifications_update_user_subscriptions_submit in Notifications 6.3

Same name and namespace in other branches
  1. 6.4 notifications.pages.inc \notifications_update_user_subscriptions_submit()
  2. 6.2 notifications.pages.inc \notifications_update_user_subscriptions_submit()

File

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

Code

function notifications_update_user_subscriptions_submit($form, $form_state) {
  $account = $form_state['values']['account'];
  switch ($form_state['values']['operation']) {
    case 'enable':

      // Enable also blocked subscriptions just in case there are some
      db_query('UPDATE {notifications} SET status = %d WHERE uid = %d', NOTIFICATIONS_SUBSCRIPTION_ACTIVE, $account->uid);
      drupal_set_message(t('All your subscriptions have been enabled.'));
      break;
    case 'disable':
      db_query('UPDATE {notifications} SET status = %d WHERE status = %d AND uid = %d', NOTIFICATIONS_SUBSCRIPTION_INACTIVE, NOTIFICATIONS_SUBSCRIPTION_ACTIVE, $account->uid);
      notifications_queue_clean(array(
        'uid' => $account->uid,
      ));
      drupal_set_message(t('All your subscriptions have been disabled.'));
      break;
  }
}