We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

I'm logged in, but conditionals say I'm not!

How Do I?

From EE Slack's avatar
From EE Slack
185 posts
2 years ago
From EE Slack's avatar From EE Slack

This came up in a private chat. You’re logged into the control panel, you put a conditional on the frontend:

{if logged_in_member_id == 1}
     this is in
{/if}

It doesn’t show! But- you’re logged in!

If {logged_in_member_id} is 0? Then you are NOT logged in on the frontend!

How can it happen? Well, if you use sessions only in the control panel, and cookies on the frontend, you aren’t logged in when you look at the frontend because the frontend wants a cookie and it has no cookie! But that wasn’t the case here.

Here- they had logged into the cp on www.mysite.com/admin.php and were viewing the frontend at mysite.com/go/me.

With cookies, by default, if you login on a www.mysite.com you are ONLY setting a cookie on that subdomain. If you go to mysite.com or store.mysite.com or… any other subdomain, the cookie isn’t set for that url.

If you set your cookie domain correctly- in this case .mysite.com (note the leading dot) the cookie is good for all of the subdomains.

Set your cookie domain unless you have a really good reason not to.

       
jaimeramirez's avatar
jaimeramirez
4 posts
one year ago
jaimeramirez's avatar jaimeramirez

Thanks for your sharing. This is what I am looking for

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.