ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

logged_in and logged_out not working correctly

July 02, 2011 11:08am

Subscribe [4]
  • #1 / Jul 02, 2011 11:08am

    FaithBuilders

    42 posts

    Hello.

    I just updated my website to version 2.2.1 and I’m having some trouble with my logged_in and logged_out content. I didn’t have any trouble with this in 2.1.3.

    The problems are visible in several ways on my website. First, after using the login form, the simple conditional in the header doesn’t recognize the newly logged in member. Here is the code:

    {if logged_in}
            
                Welcome, {screen_name}! View your <a href="https://www.faithbuilders.com/cart/account">account</a> or <a href="http://{path=LOGOUT}">logout</a>.
    
                <span class="view_cart_text">
        <a href="/cart">View cart ({exp:cartthrob:total_items_count}) {exp:cartthrob:cart_subtotal}</a> or <a href="https://www.faithbuilders.com/cart/checkout">checkout</a>.</span>
            {/if}
            
            {if logged_out}
            
                Hello, Guest! Please <a href="https://www.faithbuilders.com/member/register">register</a> or
                <a href="https://www.faithbuilders.com/cart/login">login</a>.
                
    
                
                <span class="view_cart_text">
                <a href="/cart">View cart ({exp:cartthrob:total_items_count}) {exp:cartthrob:cart_subtotal}</a> or <a href="https://www.faithbuilders.com/cart/checkout">checkout</a>.</span>                
            {/if}

    After logging in, the “Hello, Guest! Please register or login” text still appears.

    Also, I have an “account” page for customers where they can view their receipts and purchased downloads, and change their account password. On this page, I’m using {if logged_out} to display a login form, and {if logged_in} to display the links to the receipts and downloads.

    After logging in and clicking the “account” link, I see the “Account Login” title (which is part of the logged_out conditional) and a series of letters and numbers: M20o93H7pQ09L8X1t49cHY01Z5j4TT91fGfr, which also appears at the top of the page (above the header). I’ve never seen this happen before.

    To the best of my knowledge I haven’t changed these templates since upgrading. They used to work fine.

    Any advice on how to remedy this issue is greatly appreciated.

    ~Sarah

  • #2 / Jul 05, 2011 8:51am

    Sue Crocker

    26054 posts

    Hi, Sarah.

    It looks like you have sessions turned on for the front end…

    See: http://eebeginners.com/index.php/begin/articles/howto-set-cookies-only-in-security-preferences

    Does that help?

  • #3 / Jul 05, 2011 8:59am

    FaithBuilders

    42 posts

    Hi Sue, thanks for responding.

    However, that doesn’t seem to be the problem. I switched to “Cookies Only” like the tutorial said, but the website still doesn’t recognize that I have logged in. None of the {if logged_in} information appears. And, as I go through the checkout process, I am asked to log in again (customers must be logged in to make a purchase).

    I also used to be able to login to the website in one browser tab while being logged into the control panel with an admin username in another browser tab. This isn’t working anymore either. Logging into the front end website with my “Sarah” username logs me out of the control panel where I was using an admin username.

    Are there any other settings that would fix this?

    Thanks again!
    ~Sarah

  • #4 / Jul 05, 2011 9:03am

    FaithBuilders

    42 posts

    Another thing to note with login is that I can only log in to the control panel if I check the “auto login on future visits” box. However, I am not logged in on future visits. This used to work before I installed the new version.

  • #5 / Jul 05, 2011 9:52am

    Sue Crocker

    26054 posts

    Also make sure you’re accessing the site either with or without www in the url. Or you can set a cookie domain. Might that be the issue? Are you using 2.2.0 or 2.2.1?

  • #6 / Jul 05, 2011 10:15am

    FaithBuilders

    42 posts

    I accessed the site with www in the url. The whole login process uses www. I’m not familiar with cookie domains. I don’t recall using that with the previously installed version (2.1.3). I’m currently using 2.2.1.

    What is a cookie domain, and where do I find it in EE?

    Thanks again!

  • #7 / Jul 06, 2011 8:42am

    FaithBuilders

    42 posts

    Any help with this is much appreciated, as I can’t complete my website until this bug is worked out.

    Thanks!

    ~Sarah

  • #8 / Jul 07, 2011 9:11am

    FaithBuilders

    42 posts

    Users are still not recognized as being logged in. The series of letters and numbers still appears in the account. Any ideas?

  • #9 / Jul 08, 2011 11:04am

    FaithBuilders

    42 posts

    I re-installed the EE 2.2.1 files, and the problem is still persisting.

    Any guidance in the matter is greatly appreciated.

    ~Sarah

  • #10 / Jul 12, 2011 5:21pm

    Brandon Jones

    5500 posts

    Hi Sarah,

    First, make sure that you have Cookies Only specified for User Session Type, not just the Control Panel Session Type. If that doesn’t work, try setting a Cookie Domain (don’t worry about a Path or Prefix).

    As always, completely clear your browser’s cookies and cache before each test, try different browsers, etc. Let us know if that helps.

  • #11 / Jul 14, 2011 11:44am

    FaithBuilders

    42 posts

    Hi Brandon,

    I have both the control panel and user session type set to “Cookies Only”. I also tried the “Cookie Domain”, for which I used, “.faithbuilders.com”

    I’m still having trouble with both Google Chrome and IE8 (which are the only browsers I have). For some reason Google Chrome isn’t recognizing a user as logged in. The “Thank you. You are now logged in.” message appears and redirects the user to the homepage, as it should, but the {if logged_in} code isn’t showing the appropriate content (which I’ve never had trouble with in previous versions). The {if logged_out} content is showing instead. Also, a series of letters and numbers appears where a series of links should appear on the account page.

    IE8 doesn’t even let the user log in. Instead of displaying the “Thank you. You are now logged in.” message, it says, “The following errors were encountered: You are not authorized to perform this action.”

    I’m not sure where to go from here.

    ~Sarah

  • #12 / Jul 14, 2011 11:52pm

    Lisa Wess

    20502 posts

    Hi, Sarah,

    Can you check something for me? Really easy thing.

    Go to the URL for your CP and look at the domain.  Specifically, is it ‘www.example.com’ or just ‘example.com’?

    Now go to the front-end of your site?  Does that domain match exactly

    if they don’t match, the cookies won’t match and you won’t appear to be logged in.

    Let us know!

  • #13 / Jul 15, 2011 8:53am

    FaithBuilders

    42 posts

    Hi Lisa,

    You are right. The CP is using faithbuilders.com, while the front-end is using http://www.faithbuilders.com. Is there a way to make these match?

    Thanks again,

    ~Sarah

  • #14 / Jul 15, 2011 10:55am

    Lisa Wess

    20502 posts

    Which one do you want to use?

    For either, it’s a matter of making them match in Admin > General Config, and then updating your bookmarks/links. =)

  • #15 / Jul 15, 2011 11:29am

    FaithBuilders

    42 posts

    Hi Lisa,

    I switched to www in both General Config and the cookie domain. However, I seem to be unable to log in to the control panel now. Also, two computers will not allow me to login to the front-end using a “Retailer” member group username.

    How can I troubleshoot this from here?

    Thanks again!
    ~Sarah

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases