Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vensires/b083e395a3e4b6e6de9baef8064b6aec to your computer and use it in GitHub Desktop.
Save vensires/b083e395a3e4b6e6de9baef8064b6aec to your computer and use it in GitHub Desktop.
Place the following code in a custom Drupal (7.x) module to fix the issue described in https://www.drupal.org/node/2915545. Replace MODULE with your custom module's name.
<?php
/**
* Implements hook_form_mailchimp_signup_subscribe_form_alter().
*/
function MODULE_form_mailchimp_signup_subscribe_form_alter(&$form, &$form_state) {
$form['#submit'][] = 'MODULE_mailchimp_signup_subscribe_form_redirect';
}
/**
* Submit callback for mailchimp signup subscribe form.
*/
function MODULE_mailchimp_signup_subscribe_form_redirect($form, &$form_state) {
if (!isset($form_state['redirect'])) {
$form_state['redirect'] = drupal_is_front_page() ? '' : current_path();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment