This question may be related to a resolved thread.
I have been starting to work with the Solspace Users module also- and I’m having a similar problem, but my question has to do with the order in which EE tags are parsed.
Basically, I want to check to see if a user is logged in- and show the registration form if they are not logged in.
{if logged_in}
Debug: You are logged in!
{if:else}
Debug: You are logged out!
{exp:user:register form_name="register" return="http://208.86.252.6/~bellyfit/index.php/training/courses/nanaimo-april-2009"}
Username: <input type="text" name="username" class="input" size="25" /></p>
Screen Name: <input type="text" name="screen_name" class="input" size="25" /></p>
Email Address: <input type="text" name="email" class="input" size="40" /></p>
Password: <input type="password" name="password" class="input" size="25" /></p>
Confirm Password: <input type="password" name="password_confirm" class="input" size="25" /></p>
Accept Terms?: <input type="checkbox" name="accept_terms" value="y" /> Accept Terms?
<input type="submit" value="Submit" /></p>
{/exp:user:register}
{/if}
If i remove the ‘exp:user:register’ tag pair, the error dissapears, but with the above code, I get the “You are already registered and logged in.” error.
Question: Is it possible that the parsing engine sees the Register tags before the {if logged_in} tags?
Please help!
thanks, Rowan
Moved to Modules forum by Moderator
Dj-rowan–look at the parse order (http://expressionengine.com/wiki/Parse_Order/), and you’ll see that advanced conditionals (which includes ones using if:else) are parsed pretty late. Essentially both “conditions” are parsed and then the one that “fails” the condition is hidden. Try using:
{if logged_in}
Debug: You are logged in!
{/if}
{if logged_out}
Reg code...
{/if}
Hi Slapshotw -
thanks for the hint- I think it has led me to find a very practical work-around.
Dj-rowan–look at the parse order (http://expressionengine.com/wiki/Parse_Order/), and you’ll see that advanced conditionals (which includes ones using if:else) are parsed pretty late. Essentially both “conditions” are parsed and then the one that “fails” the condition is hidden. Try using:
From reading elsewhere, I understand that template embeds are parsed very late too. So, what I’ve done is placed an embed in the {if logged_out} tag pair.
{if logged_in}
Debug: You are logged in!
{/if}
{if logged_out}
Debug: You are logged out!
{embed="crew/regForm"}
{/if}
crew/regForm contains:
{exp:user:register form_name="register" return="http://208.86.252.6/~bellyfit/index.php/training/courses/nanaimo-april-2009"}
Username: <input type="text" name="username" class="input" size="25" /></p>
Screen Name: <input type="text" name="screen_name" class="input" size="25" /></p>
Email Address: <input type="text" name="email" class="input" size="40" /></p>
Password: <input type="password" name="password" class="input" size="25" /></p>
Confirm Password: <input type="password" name="password_confirm" class="input" size="25" /></p>
Accept Terms?: <input type="checkbox" name="accept_terms" value="y" /> Accept Terms?
<input type="submit" value="Submit" /></p>
{/exp:user:register}
This is working so far for me. If I encounter any more problems with this, I will post again.
Thanks for the help!
rowan
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.