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

Problem testing for logged in users

How Do I?

JCOGS Design's avatar
JCOGS Design
71 posts
6 years ago
JCOGS Design's avatar JCOGS Design

I am trying to redirect a page if its URL is hit and there is no logged in user.

I have put various variations of the following into the lead template of a template layout stack, but it seems to be ignored.

{if logged_out}{redirect='...some other template...'}{/if}

I loaded up mo variables and tried using the early parsed variables that offers but got no better results - e.g. this doesn’t work:

{logged_in_member_id = '0'}{redirect='info/member-login-registration'}{/if}

I have checked and logged_in_member_id is reported as ‘0’ on the site when no user is logged in.

So I’m doing something dim, but not sure what.

Any guidance / suggestions would be most welcome 😊

       
JCOGS Design's avatar
JCOGS Design
71 posts
6 years ago
JCOGS Design's avatar JCOGS Design

Fixed it = was user error as I suspected - the conditional was not being evaluated due to other logic earlier in the template.

       
Robin Sowell's avatar
Robin Sowell
13,158 posts
6 years ago
Robin Sowell's avatar Robin Sowell

Nice catch- and thanks for letting us know what was up with it!

       

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.