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.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.