You are here

function notifications_subscription_form_submit in Notifications 6.2

Same name and namespace in other branches
  1. 6.4 notifications.module \notifications_subscription_form_submit()
  2. 6 notifications.pages.inc \notifications_subscription_form_submit()
  3. 6.3 notifications.pages.inc \notifications_subscription_form_submit()
  4. 7 notifications.module \notifications_subscription_form_submit()

Save edited subscription

File

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

Code

function notifications_subscription_form_submit($form, $form_state) {

  // Rebuild subscription object
  $subscription = $form_state['values']['subscription'];
  foreach (array(
    'send_interval',
    'send_method',
    'status',
  ) as $field) {
    if (isset($form_state['values'][$field])) {
      $subscription->{$field} = $form_state['values'][$field];
    }
  }
  switch ($form_state['values']['op']) {
    case t('Save'):
      notifications_save_subscription($subscription);
      break;
    case t('Delete'):
      notifications_delete_subscription($subscription->sid);
      $form_state['redirect'] = 'user/' . $subscription->uid . '/notifications';
      break;
  }
}