Safecracker Executes causes problems with other forms
Posted: 23 February 2011 05:02 AM   [ Ignore ]
Wallflower
Rank
Total Posts:  20
Joined  2010-04-08

Safecracker seems to be executing whether or not a logged_in conditional is true, which affects the action id of other forms. For example, I had something like this:

if logged_in
   show safecracker
if:else
   
show login form
/if 

Safecracker was executing even though I wasn’t logged in. So, when I tried to use my login form, the ACT id was wrong, causing the login to fail by redirecting to a blank home page without logging me in. Moving Safecracker to an embed got me around the problem.

Profile
 
 
Posted: 23 February 2011 05:07 AM   [ Ignore ]   [ # 1 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

This is because of a limitation in the EE parsing engine. Advanced conditionals get parsed after module/plugin tags. Advance conditionals are classified as: conditionals with multiple expressions ({if something && something else}), conditionals with non-global variables ({if my_custom_field == 'something'}), or conditionals with else/elseif. So yours is the correct solution to get around this. Another solution would be to remove the if:else by using two conditonals:

{if logged_in}
   show safecracker
{
/if}
{if logged_out}
   show login form
{
/if} 
Profile