<p>In your <code>redirect</code> hidden input in your form, add an <code>{id}</code> tag like so:</p>

<pre><code>&lt;input type="hidden" name="redirect" value="nextStep/{id}"&gt;
</code></pre>

<p>And that will be populated with the newly created user's userId.</p>

<blockquote>
  <p>Is there a corresponding getNotices() similar to getErrors() or some way to retrieve these on the front-end?</p>
</blockquote>

<p>You'd have to duplicate the code that the control panel uses to retrieve the notices on the front-end of the site.</p>

CC BY-SA 3.0
2014-09-25T23:33:11.013Z
Thank you Brad! Half way there. `value="nextStep/{id}` leads me to a page not found... I assume that I would need to create a route for that to work? If I use `value="nextStep.html?id={id}"` then I can retrieve the id fine. On step 3, however, I would need to return the entryId from step2 and the userId from step 1 — possible? or are we now in the land of plug-ins with cache, session storage, etc?
Douglas McDonald
CC BY-SA 3.0
2014-09-26T01:19:39.157Z
yeah, you'd need a route or just use it in the querystring. I'm not sure what your step 2 and step 3 are posting to. Probably worth a new question with some more details explaining what you're trying to do.
Brad Bell
CC BY-SA 3.0
2014-09-26T01:50:49.873Z
Step 1 registers a user; Step 2 creates a channel entry to 'accounts' related to user; step 3 creates a channel entry to 'subscriptions' related to 'accounts'. Basically, just want to know if there is way to pass some variables through `action/saveUser` and `action/saveEntry`? Sounds like it might be time to learn how to write my own controllers - wish me luck. And thanks again!
Douglas McDonald
CC BY-SA 3.0
2014-09-26T04:17:20.717Z
Yup... a plugin would probably simplify things. Good luck!
Brad Bell
CC BY-SA 3.0
2014-09-25T22:57:45.147Z
2014-09-25T22:57:45.147Z
Brad Bell
<p>Is there a way to return a user model entry, userid, or some other identifier (and/or variables in general) from a successful registration form submission using the hidden redirect parameter?</p>

<p>In the docs for <a href="http://buildwithcraft.com/classreference/controllers/UsersController#actionSaveUser-detail" rel="nofollow">action/saveUser</a> I see some mention of {id} in the redirect string, but I'm not exactly sure sure how this works (or if it's even related).</p>

<pre><code>      if (isset($_POST['redirect']) &amp;&amp; mb_strpos($_POST['redirect'], '{userId}') !== false)
      {
           craft()-&gt;deprecator-&gt;log('UsersController::saveUser():userId_redirect', 'The {userId} token within the ‘redirect’ param on users/saveUser requests has been deprecated. Use {id} instead.');
           $_POST['redirect'] = str_replace('{userId}', '{id}', $_POST['redirect']);
      }
</code></pre>

<p>The reason I ask is that I am creating a multipart form that relies on the values of the previous form submission to continue (starting with user account registration). I essentially want to redirect back to the form, fill out the next part, submit, redirect back to form, fill out next, etc. (controlling the workflow with javascript or twig). FYI, using <code>impersonate()</code> will not work for me in this case, because user must be admin, or in a custom 'manager' group.</p>

<p>As a side question, I also see <code>craft()-&gt;userSession-&gt;setNotice(Craft::t('User saved.'));</code> used throughout the saveUser controller. Is there a corresponding <code>getNotices()</code> similar to <code>getErrors()</code> or some way to retrieve these on the front-end?</p>

<form><variable><redirect>
Is it possible to return a User Model Entry or userid from a successful registration form submission?
# Is it possible to return a User Model Entry or userid from a successful registration form submission?

(Asked by: username_0 on 2014-09-25)

Is there a way to return a user model entry, userid, or some other identifier (and/or variables in general) from a successful registration form submission using the hidden redirect parameter?
In the docs for action/saveUser I see some mention of {id} in the redirect string, but I'm not exactly sure sure how this works (or if it's even related).
      if (isset($_POST['redirect']) && mb_strpos($_POST['redirect'], '{userId}') !== false)
      {
           craft()->deprecator->log('UsersController::saveUser():userId_redirect', 'The {userId} token within the ‘redirect’ param on users/saveUser requests has been deprecated. Use {id} instead.');
           $_POST['redirect'] = str_replace('{userId}', '{id}', $_POST['redirect']);
      }

The reason I ask is that I am creating a multipart form that relies on the values of the previous form submission to continue (starting with user account registration). I essentially want to redirect back to the form, fill out the next part, submit, redirect back to form, fill out next, etc. (controlling the workflow with javascript or twig). FYI, using impersonate() will not work for me in this case, because user must be admin, or in a custom 'manager' group.
As a side question, I also see craft()->userSession->setNotice(Craft::t('User saved.')); used throughout the saveUser controller. Is there a corresponding getNotices() similar to getErrors() or some way to retrieve these on the front-end?

**Tags:** form, variable, redirect


---

## 1 answers

### Answer by username_1 on 2014-09-25. Score: 1 | Accepted answer

In your redirect hidden input in your form, add an {id} tag like so:


And that will be populated with the newly created user's userId.

Is there a corresponding getNotices() similar to getErrors() or some way to retrieve these on the front-end?

You'd have to duplicate the code that the control panel uses to retrieve the notices on the front-end of the site.

> **Comments:**
> **username_0**: Thank you Brad! Half way there. `value="nextStep/{id}` leads me to a page not found... I assume that I would need to create a route for that to work? If I use `value="nextStep.html?id={id}"` then I can retrieve the id fine. On step 3, however, I would need to return the entryId from step2 and the userId from step 1 — possible? or are we now in the land of plug-ins with cache, session storage, etc?  
> **username_1**: yeah, you'd need a route or just use it in the querystring. I'm not sure what your step 2 and step 3 are posting to. Probably worth a new question with some more details explaining what you're trying to do.  
> **username_0**: Step 1 registers a user; Step 2 creates a channel entry to 'accounts' related to user; step 3 creates a channel entry to 'subscriptions' related to 'accounts'. Basically, just want to know if there is way to pass some variables through `action/saveUser` and `action/saveEntry`? Sounds like it might be time to learn how to write my own controllers - wish me luck. And thanks again!  
> **username_1**: Yup... a plugin would probably simplify things. Good luck!  

---

