0

My frontend has a sidebar that is embedded by most of my frontend's pages. In that sidebar template, there is a conditional that goes something like this:

{if logged_in}
   ...
   ...
   {embed="foo/bar"}
   ...
   ...
{/if}
{if logged_out}
   ...
   ...
   ...
{/if}

(The ... indicates plain HTML stuff.)

Everything works as expected -- except on my /sign-up/ page. On the /sign-up/ page, it's as if I am logged in. I see the markup inside the {if logged_in} conditional and the results of the embed. I do not see the markup inside the {if logged_out}.

Other parts of the page has similar logged_in and logged_out checks -- and they all seem to be working fine. The problem is isolated to just the sidebar. This is very strange to me. Any ideas what might cause this problem?

UPDATE 1:

Note the {embed="foo/bar"}. It contains a SafeCracker Registration form. Here's the opening tag:

{exp:channel:form
    channel="profiles"
    class="form-horizontal apply-nolazy"
    datepicker="no"
    dynamic_title="[email]"
    error_handling="inline"
    id="registration-form"
    include_assets="no"
    include_jquery="no"
    loggin_member="no"
    register_member="yes"
    return="/sign-up/verify-email-address/"
    rules:birthdate="required"
    rules:gender="required"
    rules:profile_name="required|max_length[25]"
    rules:user_provided_address="required"
    secure_action="yes"
    secure_return="yes"
}

When I comment out the embed, the {if logged_in} and {if logged_out} checks in the template that embeds the SafeCracker Registration form are respected. It's as if the embedding of the form causes the conditionals to misbehave. Is this somehow a problem with SafeCracker Registration Form?

4
  • 1
    Have you any caching settings active in your template preferences? Jul 14, 2014 at 4:26
  • Updated question with a possible clue. Jul 14, 2014 at 10:09
  • Check for other conditionals exclusively on this page. It looks like a broken conditional to me.
    – Sobral
    Jul 17, 2014 at 20:06
  • Can we see a direct copy/paste of the whole of the embedded template at all? Just seeing the opening tag doesn't let us check if there might be something else incorrect in that template somewhere. Also have you tried using the if logged_in tag and redirecting the user to a different template (your form specifically) and see if that works. Try accessing the form directly and see if it still thinks you're logged in.
    – Mark Bowen
    Sep 16, 2014 at 17:07

4 Answers 4

0

Have you tried an alternate combo? Rather than running 2 conditionals to check if someone is either logged in or out, trying:

{if logged_in}
   ...
   ...
   {embed="foo/bar"}
   ...
   ...
{if:else}
   ...
   ...
   ...
{/if}
0

You need to set the dynamic feature for this to no so that it isn't parsing any other information beyond this form through the URL. You can read about it here:

http://ellislab.com/expressionengine/user-guide/add-ons/channel/channel_entries.html#dynamic

1
0

use tag disable="member_data" in channel form.

{exp:channel:form
    channel="profiles"
    class="form-horizontal apply-nolazy"
    datepicker="no"
    dynamic_title="[email]"
    error_handling="inline"
    id="registration-form"
    include_assets="no"
    include_jquery="no"
    loggin_member="no"
    register_member="yes"
    return="/sign-up/verify-email-address/"
    rules:birthdate="required"
    rules:gender="required"
    rules:profile_name="required|max_length[25]"
    rules:user_provided_address="required"
    secure_action="yes"
    secure_return="yes"
    disable="member_data"
}

i think that works for you

1
0

There are many options. Here's a fun one.

Install Mo' Variables (for free) and do this. Also, make sure template caching for the embed is turned off.

{if logged_in_member_id != ""}
   ...
   ...
   {embed="foo/bar"}
   ...
   ...
{/if}
{if logged_in_member_id == ""}
   ...
   ...
   ...
{/if}
2
  • Actually Mo' Variables is already installed. Jul 27, 2014 at 21:26
  • If you put {logged_in_member_id} in the template, what does it output?
    – GDmac
    Oct 15, 2014 at 21:26

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.