it overrides our redirect

Comments

drawk’s picture

Actually, it is quite a bit worse than overriding the destination redirect. It actually ignores the destination *and* doesn't delete the item (never makes it to the confirmation page).

drawk’s picture

To fix both issues (not redirecting, and not deleting), change the functions subs_form_submit_delete() in subs.pages.inc to the following:

function subs_form_submit_delete($form, &$form_state) {
  global $base_url;

  $subscription = $form_state['subscription'];
  $subscription_uri = entity_uri('subs', $subscription);
  $redirect_path = $subscription_uri['path'] . '/delete';
  $dest = drupal_get_destination();
  unset($_GET['destination']);
  if (isset($dest['destination'])) {
    // for the reason we use $base_url here, see: http://stackoverflow.com/questions/4143115/can-i-set-a-form-state-redirect-with-a-destination-parameter-in-form-submission
    $form_state['redirect'] = $base_url . '/' . $redirect_path . '?'. $dest['destination'];
  }
  else {
    $form_state['redirect'] = $redirect_path;
  }
}

I haven't submitted a proper patch because many kittens die when you do the above. But it should give the maintainers a good idea of where the problem is.

alexweber’s picture

Thanks drawk, I'll mop up the kittens. :)