Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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';
}
}
Comment | File | Size | Author |
---|---|---|---|
#3 | mailchimp_form_state_error_2148443_2.patch | 909 bytes | tomb-2 |
#1 | mailchimp_form_state_error_2148443_1.patch | 910 bytes | tomb-2 |
Comments
Comment #1
tomb-2 CreditAttribution: tomb-2 commentedComment #2
tomb-2 CreditAttribution: tomb-2 commentedComment #3
tomb-2 CreditAttribution: tomb-2 commentedLast patch was bad.
Comment #4
amytswan CreditAttribution: amytswan at ThinkShout commented“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!”