Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
407 views
in Q2A Core by

I am trying to secure the qa site to ensure that only the logon users are able to access the site. The site is integrated with WordPress.

I am using the following script at the beginning of qa-index.php.

global $qa_login_userid;

if (isset($qa_login_userid)) {
 // user is logged in
    exit;
} else {
 // no user is logged in
header("Location: http://www.mybrainsfood.com/wp-login.php");
};

The problem is, both cases the redirection will be executed. Can someone guide me please?

Thank you.

Q2A version: 1.5.2

1 Answer

0 votes
by

You want to use qa_get_logged_in_userid() instead of the global.

...