Check aMember Login status w/JavaScript

Discussion in 'Integration' started by nomaddesign, Nov 25, 2013.

  1. nomaddesign

    nomaddesign Member

    Joined:
    Aug 25, 2005
    Messages:
    63
    I'm building a JavaScript widget which checks aMember logged-In status (cookie). If user is logged in the widget makes an ajax request to a seprate page with a Am_Lite::getInstance() php script to retrieve the user's name. This is to display a "Hi [member_name] | Logout" or "Please Login" message in the upper right corner of public webpages.

    The problem is the amember_nr, amember_ru cookies are "httpOnly" restricted, therefor NOT accessible to JavaScript.

    How or where could I go about setting an "unrestricted" cookie which would indicate a user's logged in status????
    Do I need to create an intergration plugin?? or can I modify a template to set and unset a logged-in cookie?

    The reason for doing this is we get big traffic spikes to the public portions of the website. I want to use server caching / CDN for the public webpages and use JavaScript to render the ""Hi [member_name] | Logout" -or- "Please Login" corner. I also don't want to hit aMember on every page load to check aMember status. This would unnecessarily stress the web server.


    Make sense?

    Thanks!

Share This Page