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


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?
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.
Top Bottom