I have the following issue:

I have a simple login form on a simple template with some content wrapped in {if logged_in} conditional. I submit the login form, get the "Thank you, you are logged in" message, get redirected back to the template and still see the content in the {if logged_out} conditional i.e. the login form, and the {member_id} is 0.

A previous dev may have done something to prevent spam member registrations and I am trying to figure out what and where and how to fix.

Any insight or anything that would point me in the right direction would be much appreciated.


  • Well it's not a registration page so it wouldn't follow that the login form would be affected, unless their addon hooked to all form submissions. Can you look at your Your Site -> CP Home -> Add-ons -> Extensions page in your CP and see if you see anything funny/home brewed?
    – jrothafer
    Commented Jul 17, 2015 at 16:01
  • I'm also going to ask you check Your Site -> CP Home -> Administration -> Security and Session Preferences page for anything funny/illicitly set, as well as Your Site -> CP Home -> Administration -> Cookie Settings page.
    – jrothafer
    Commented Jul 17, 2015 at 16:02
  • @jrothafer Thanks for the suggestions! Unfortunately, there are no unusual extensions installed. The Security&Sessions preferences look normal, User Session Type is set to Cookies only.The Cookie settings are all empty, which I believe is normal as well.
    – Alexander
    Commented Jul 20, 2015 at 13:03

3 Answers 3


Ok, this might not be the answer but I'm not going to type all this out in a comment.

Could you please post your template code? This could help me pinpoint any issues there, but it doesn't seem likely to be the problem.

Next, please take a good look at your .htaccess file. You can definitely mess with cookies in there. Also, even more important, is to check to see if this is an environment issue.


Rock this command somewhere, and grep/search that page for "cookie". Find the "Session" section of your phpinfo() call, and look for any funny settings there (like if session.use_cookies is set to "No", you've got some environment problems!). Let me know if any of this helps you.

  • I had already checked all these and they weren't the isssue. I eventually figured it out, check below. Thanks for all your suggestions!
    – Alexander
    Commented Jul 23, 2015 at 9:39

Check any template caching you may have turned on as that can interfere with content updating after logging in.

Some solutions:

  1. Turn off caching for the template the member is redirected back to.
  2. Convert member content into an embed template, that way you can leave caching on on the main template but not caching the embed will allow content to update.
  • Thanks for suggesting that, but caching wasn't the issue. Below is what happened.
    – Alexander
    Commented Jul 23, 2015 at 9:40

Turned out the IP address stored for the session didn't match the session IP address and that's why an active session couldn't be created.

I had to go in /system/codeigniter/system/core/Input.php and switch some of the if cases around in function ip_address(), so that I store server('REMOTE_ADDR') instead of server('HTTP_X_FORWARDED_FOR').

And then everything worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.