WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] is_user_logged_in() incompatible with firefox and chrome? (9 posts)

  1. stant0n
    Member
    Posted 4 years ago #

    Under Internet Explorer 8, everything works as expected.
    Under Firefox 3.6.6 and Chrome 4.1 any time a link is clicked on the site (and the link isn't listed on a menu or sidebar) the is_user_logged_in() function always returns false.

    Here's what I'm doing. On http://www.backtolifemeditations.com I've created a custom header menu that will direct logged in users to a different product page than those not logged in.
    This product page contains links to other products.
    If you click on one of these links using Firefox or Chrome, the Logout button switches to a Login button and the custom menu directs to the wrong page.

    I've been troubleshooting this for a couple hours and can't figure this out. If I add one of the product pages to the sidebar or header menu's the behavior is resolved. However I can't have the menus cluttered with every product page.

    Any ideas?

  2. Agus Suhanto
    Member
    Posted 4 years ago #

    Basically is_user_logged_in() will check the authentication cookie that has been set when the user is logged in. After login, this cookie should remain intact within cookie store of the browser and it is sent back on each subsequent request. I suggest you use a debugging tool like Fiddler to see why the authentication cookie is no longer there.

  3. MarkRH
    Member
    Posted 4 years ago #

    I registered on the site just to see. Using Firefox 3.6.8. At the moment I seem to stay logged in even after restarting the browser. The only cookie problem I could see was that paypal.com was trying to set a cookie with an invalid date.. but that's their problem. Or it might be because I have 3rd party cookies disabled at the moment.

  4. stant0n
    Member
    Posted 4 years ago #

    Hey guys,
    I'll look into the cookies but I don't think thats the problem. Because like you said Mark, you don't actually get logged out. The function just reports false, incorrectly.

    If you login to the site, go to the "Meditations" page and then try to browse the CD's at the bottom, you'll see the function fail as the "Logout" button will change to "Login". But as soon as you use any of the links on the menu, the function begins working properly and you'll see that you're still logged in.

  5. MarkRH
    Member
    Posted 4 years ago #

    Figured out the problem. The cookies are being set with a backtolifemeditations.com domain when logging in; however, the CD pages below are going to www.backtolifemeditations.com instead so the cookie does not match. Need to make sure all the links in your blog go to either backtolifemeditations.com or http://www.backtolifemeditations.com and not a mixture of both.

    Hope that helps,
    Mark H.

  6. stant0n
    Member
    Posted 4 years ago #

    Ah! Thanks so much Mark.
    I changed the blog to http://www.backtolifemeditations.com and the issue appears to be resolved.

    Odd that IE could work around this though.

    Thanks again!

  7. Nanowisdoms
    Member
    Posted 3 years ago #

    MarkRH, would this

    The cookies are being set with a backtolifemeditations.com domain when logging in; however, the CD pages below are going to http://www.backtolifemeditations.com instead so the cookie does not match.

    explain the problem I'm having here:

    http://wordpress.org/support/topic/is_user_logged_in-not-working-when-wordpress-address-urlsite-address-url?replies=1#post-2066529

    And if so how can make this work (i.e. adduress URL domain & site URL domain are different) so I can tell if someone is logged in and get their user info?

    Thanks for any help.

  8. jfe63
    Member
    Posted 3 years ago #

    Good day,

    I found the solution to this. There is some issue with the settings of the site URL domain and wordpress site.

    [referral link redacted] It works for me. I also face the same problem and found some way to solve it. Hope it works for you too. Let me know too if you found a better way.

    Bryan

    Founder of [signature moderated]

  9. Nanowisdoms
    Member
    Posted 3 years ago #

    jfe63, not sure your link is supposed to go, but doesn't seem to have a solution to the issue.

    Nevertheless I found a solution and posted detailed explanations in the thread I had started about this issue (mentioned above also):
    http://wordpress.org/support/topic/is_user_logged_in-not-working-when-wordpress-address-urlsite-address-url?replies=1#post-2066529

    Hope this helps.

Topic Closed

This topic has been closed to new replies.

About this Topic