function formalterations_form_mailchimp_lists_user_subscribe_form_alter(&$form, &$form_state) {
  $form['#submit'][] =  'formalterations_lists_user_subscribe_form_submit';
}
function formalterations_lists_user_subscribe_form_submit($form, &$form_state) {
    $form_state['redirect'] = 'node/109614';
}

When using form alter to redirect the subscription to a new page, the redirect happens even when the submission fails. I have added a variable: $form_status['error'] to check if the form submission failed.

function formalterations_form_mailchimp_lists_user_subscribe_form_alter(&$form, &$form_state) {
  $form['#submit'][] =  'formalterations_lists_user_subscribe_form_submit';
}
function formalterations_lists_user_subscribe_form_submit($form, &$form_state) {
  if($form_state['error'] == FALSE){
    $form_state['redirect'] = 'node/109614';
  } 
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tomb-2’s picture

Status: Active » Needs review
FileSize
910 bytes
tomb-2’s picture

Issue summary: View changes
tomb-2’s picture

Issue summary: View changes
FileSize
909 bytes

Last patch was bad.

amytswan’s picture

Status: Needs review » Closed (won't fix)

“And now our watch [for support of the 7.x-2.x version of the MailChimp module] has ended…” With the approaching deprecation of MailChimp’s API version 2.0, I’m sad to say we too must turn the page. This branch will become unsupported in early October and officially deprecated by the end of this year (2016).

Fret not! The 7.x-4.x and 8.x versions come highly recommended. Both are using Mailchimp’s new API 3.0 and are being actively maintained. If you find this issue still exists on either the 7.x-4.x or 8.x branches, let us know by opening a new ticket. “What is dead may never die, but rises again, harder and stronger!”