You are here

function simplenews_subscription_list_form_submit in Simplenews 7.2

Same name and namespace in other branches
  1. 5 simplenews.module \simplenews_subscription_list_form_submit()
  2. 6.2 includes/simplenews.admin.inc \simplenews_subscription_list_form_submit()
  3. 6 simplenews.admin.inc \simplenews_subscription_list_form_submit()
  4. 7 includes/simplenews.admin.inc \simplenews_subscription_list_form_submit()

@todo

1 string reference to 'simplenews_subscription_list_form_submit'
simplenews_subscription_list_form in includes/simplenews.admin.inc
Menu callback: subscription administration.

File

includes/simplenews.admin.inc, line 1152
Newsletter admin, subscription admin, simplenews settings

Code

function simplenews_subscription_list_form_submit($form, &$form_state) {

  // Call operation functions as defined in hook_simplenews_subscription_operations().
  $operations = module_invoke_all('simplenews_subscription_operations');
  $operation = $operations[$form_state['values']['operation']];

  // Filter out unchecked subscribers
  $snids = array_filter($form_state['values']['subscribers']);
  if ($function = $operation['callback']) {

    // Add in callback arguments if present.
    if (isset($operation['callback arguments'])) {
      $args = array_merge(array(
        $snids,
      ), $operation['callback arguments']);
    }
    else {
      $args = array(
        $snids,
      );
    }
    call_user_func_array($function, $args);
    drupal_set_message(t('The update has been performed.'));
  }
  else {

    // We need to rebuild the form to go to a second step. For example, to
    // show the confirmation form for the deletion of nodes.
    $form_state['rebuild'] = TRUE;
  }
}