diff --git a/multistep/multistep.module b/multistep/multistep.module index 2bea8b5..133b002 100644 --- a/multistep/multistep.module +++ b/multistep/multistep.module @@ -493,8 +493,12 @@ function multistep_form_alter(&$form, &$form_state, $form_id) { // Disable immediate redirection through "destination" parameter, but preserve the destination value. if (isset($_REQUEST['destination'])) { $dest = $_REQUEST['destination']; - unset($_REQUEST['destination']); - drupal_goto($_REQUEST['q'], array('redirect' => $dest)); + unset($_REQUEST['destination']); + $query = array('redirect' => $dest); + if (isset($_REQUEST['edit'])) { + $query = array_merge( $query , array('edit' => $_REQUEST['edit'])); + } + drupal_goto($_REQUEST['q'], $query); } // We need to remove #redirect to prevent redirection to the profile main page if (module_exists('content_profile') && is_content_profile($type)) { @@ -677,8 +681,11 @@ function multistep_submit($form, &$form_state, $action) { global $user; $form_state['redirect'] = 'user/' . $user->uid . '/profile/' . $type . '/' . $goto_step; } - else { - $form_state['redirect'] = array('node/' . $nid . '/edit/' . $goto_step, (isset($_REQUEST['redirect']) ? array('redirect' => $_REQUEST['redirect']) : array())); + else { + $redirect = isset($_REQUEST['redirect']) ? array('redirect' => $_REQUEST['redirect']) : array(); + $edit = isset($_REQUEST['edit']) ? array('edit' => $_REQUEST['edit']) : array(); + $query = array_merge($redirect,$edit); + $form_state['redirect'] = array('node/' . $nid . '/edit/' . $goto_step, $query); } } else {