1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.4 Check if someone is logged in and redirect on non-xenforo page

Discussion in 'XenForo Questions and Support' started by MarkMark, Jun 18, 2015.

  1. MarkMark

    MarkMark Member

    Is there a way to see whether someone is logged in and, if so, redirect them to the forums?

    The reason I ask is because I use a static HTML page as my domain's landing page, with the option to login or register (eg www.mydomain.com/index.html). However, I'd like to check if someone is already logged in, and automatically redirect to www.mydomain.com/forums/ using perhaps a javascript location.replace command.

    How can I check whether someone is already logged in from outside the system itself?
  2. Mike

    Mike XenForo Developer Staff Member

    There isn't really a way to do this from outside the system (allowing it would potentially create a security issue).
  3. MarkMark

    MarkMark Member

    Isn't there a way to check if a user is logged in my checking for a cookie? I'm just not sure how to code this.
  4. Mike

    Mike XenForo Developer Staff Member

    There isn't a way to be 100% correct from just a cookie, but you can look for the presence of a xf_user cookie if the user has chosen to stay logged in.

Share This Page