1

I’ve seen an example almost identical to what I’m trying to attempt here: How to get attempted url before access restriction? However, my templates don’t see to want to cooperate: Template 1:

    {if logged_in}
     {embed="myfig/upload-view"}
    {if:else}
     {exp:stash:set name="login_form_return" scope="user" save="yes"}{segment_2}    {/exp:stash:set}
    {redirect="/myfig/"}
    {/if} 

Template 2:

Stash: {exp:stash:get name="login_form_return"}

{if '{exp:stash:get name="login_form_return"}'} Proof Manager {if:else} Something else {/if}

{exp:zoo_visitor:login_form error_handling="inline" } {if '{exp:stash:get name="login_form_return"}' =="myfig/proofmanager"} <input type="hidden" name="RET" value='myfig/proofmanager' /> {if:else} <input type="hidden" name="RET" value="/myfig/dashboard/" /> {/if}

Nothing returns on my GET attempt. What am I doing wrong?

2 Answers 2

2

This will most likely be to do with parse order. EE templates get processed in layers rather than top to bottom and you're using a complex conditional. To move it up the parse order try this:

{if logged_in}
    {embed="myfig/upload-view"}
{/if}
{if logged_out}
    {exp:stash:set name="login_form_return" scope="user" save="yes"}{segment_2}    {/exp:stash:set}
    {redirect="/myfig/"}
{/if}

This converts it to a simple conditional and may very well solve the issue.

3
  • Hi Ian - This didn't work. Any other thoughts?
    – Jon Nixon
    Apr 28, 2013 at 11:38
  • The first thing to check would be that the conditionals are working correctly. Does logged_out work successfully if you remove the Stash tag and redirect and place a string ("I'm logged out") in there? Also just experiment with outputting the Stash variable within that conditional and remove the redirect. If you call {exp:stash:login_form_return} right after setting it does it display segment_2 correctly?
    – Ian Young
    Apr 28, 2013 at 20:16
  • Glad that helped Jon. As it is the redirect then try setting scope="site" and keep save="yes" in there. Does that carry across to the page redirect?
    – Ian Young
    Apr 29, 2013 at 8:49
0

The redirects were killing the session. I had to try a different method of embedding a login form in the template I was in instead of redirecting

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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