You are here

function notifications_add_subscription_form_submit in Notifications 6.3

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

Submit new subscription

File

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

Code

function notifications_add_subscription_form_submit($form, &$form_state) {
  $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
  if ($op == t('Create subscription')) {
    $subscription = array(
      'type' => $form_state['values']['type'],
      'uid' => $form_state['values']['account']->uid,
      'send_method' => $form_state['values']['send_method'],
      'send_interval' => $form_state['values']['send_interval'],
      'fields' => $form_state['field_values'],
    );
    $result = notifications_save_subscription($subscription);
    if ($result === SAVED_NEW) {
      drupal_set_message(t('Your subscription has been created.'));
    }
    else {
      drupal_set_message(t('Your subscription cannot be created.'), 'error');
    }
  }
}