1

That question will almost certainly need to be rewritten, but at the moment I don't have the language to write it well (sorry).

We have a restricted item (asset, in this case) that successfully triggers the login form and then redirects the viewer to the restricted item after login.

What about if the viewer is not registered yet? We have a working registration form set up and auto-activation enabled. How can the referring restricted item be passed from the login form to the registration form and then have that restricted item shown immediately after registering?

2

You should be able to get the return url from craft. I just did a quick test and it seemed to carry over to a registration page from a log in page that happened due to a restricted page, so maybe try something like this in your registration template:

{% set redirectUrl = (craft.session.getReturnUrl() ?: '/') %}

<input type="hidden" name="redirect" value="{{ redirectUrl }}">

That way after they register they will be redirected to the restricted page, asked to log in and then craft should redirect them to the restricted page automatically.

Hope that helps!

  • Brilliant, it works! Thank you! (and sorry for the looooong response time) – Kirk Roberts Jun 16 '15 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.