You are here

function subscriptions_add_form_submit in Subscriptions 2.0.x

Same name and namespace in other branches
  1. 5.2 subscriptions.admin.inc \subscriptions_add_form_submit()
  2. 6 subscriptions.admin.inc \subscriptions_add_form_submit()
  3. 7 subscriptions.admin.inc \subscriptions_add_form_submit()

Add Subscription form submit handler.

_state

Parameters

array $form:

File

./subscriptions.admin.old.php, line 1037
Subscriptions module (load-on-demand admin functions).

Code

function subscriptions_add_form_submit(array $form, array &$form_state) {
  if ($a = module_invoke_all('subscriptions', 'stype', $form_state['values']['stype'], $form_state['values']['sid'], isset($form_state['values']['author_uid']) ? $form_state['values']['author_uid'] : -1)) {

    // Allow other modules to alter the data.
    drupal_alter('subscriptions_stype', $a);
    list($module, $field, $value, $author_uid) = $a;
    $uid = $form_state['values']['uid'];
    subscriptions_write_subscription($module, $field, $value, $author_uid, $uid, $form_state['values']['send_interval'], $form_state['values']['updates'], $form_state['values']['comments']);
    drupal_set_message(t('Your subscription was activated.'));
    $form_state['redirect'] = '<front>';
  }
  else {
    drupal_set_message(t('Your subscription could not be activated.'));
  }
}