Is it possible to log a user back into their form but redirect them specifically to the step of the form they left off on when they logged out? So they may have completed step 1 but not step 2. When they log back in I want them to be on the step 2 page immediately.

Is this doable?

-backdrifting

Comments

Bilmar’s picture

subscribing

bluestarstudios’s picture

+1 subscribing.

bluestarstudios’s picture

any news? I've read in one of the last released versions that there was an added feature to determine the submitted steps. Maybe that would help? Any ideas?
Thanks

robby.smith’s picture

+1 subscribing

scottrigby’s picture

You could add this to your custom module's hook_form_alter()

$node = $form['#node'];
  if (isset($node->nid) && !arg(3)) {
    $result = db_query("SELECT MIN(step) FROM {multistep} WHERE status = 'unsubmitted' AND nid = %d", $node->nid);
    if ($step = db_result($result)) {
      // Exit if coming from the command-line (needed for drush),
      // or if we're not calling index.php (so cron.php, xmlrpc.php, etc, works).
      if (php_sapi_name() == 'cli' ||
        str_replace(base_path(), '', $_SERVER['SCRIPT_NAME']) != 'index.php') {
        return;
      }

      drupal_set_message(t('You have been directed to the last unsubmitted step.'));
      drupal_goto('node/' . $node->nid . '/edit/' . $step);
    }
  }
scottrigby’s picture

Though it might be useful to add this as a configurable option to multistep…