Javascript or php method for detecting if user logged in?

Discussion in 'Templates customization' started by craigjwallace, Dec 19, 2016.

  1. craigjwallace

    craigjwallace aMember Pro Customer

    Joined:
    Aug 15, 2015
    Messages:
    11
    Hello Amember community

    I am developing a site, where my header menus are different depending on whether a user is logged in or not. For the 'logged in' cases, users get different heading in the menu.

    For my member-side and protected pagesI have no probs: I just point the pages to use the correct header code.

    However, if a user is logged in, but navigates back to, say, the company homepage, then obviously that HTML page loads the other (i.e. non-logged-in) menu.

    Is there a slice of JS or PHP code I can put in my HTML to detect whether the visitor to the page is logged in - and thus use the different menu code that I have?

    As I say, the member-side pages are fine, It is the pages outside the member-zone / protection that I want to respond, depending on the viewer's status.

    Thanks in advance for any tips!
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    1,659
    craigjwallace likes this.
  3. craigjwallace

    craigjwallace aMember Pro Customer

    Joined:
    Aug 15, 2015
    Messages:
    11
    Brill - thanks Caesar, that will do nicely.
  4. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    1,659
    I am glad to hear that. You are welcome!

Share This Page