Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
272 views
in Q2A Core by
Hi. Is there any way to show only Register and Login Pages for guests ???? I dont want them to display any content of my website unless they Login or Register.
Q2A version: 1.6

1 Answer

+1 vote
by

I think this would be possible with a plugin. Take a look at process plugins here. You should use the init_page() function, with something along the lines of:

function init_page()
{
    $request = qa_request();
    if ($request == 'login' || $request == 'register')
        return;

    $userid = qa_get_logged_in_userid();
    if ($userid !== null)
        return;

    // here the user is not logged in, and it's not the register/login page
    // do something here to output a different page

    // quit here to avoid Q2A outputting the regular page
    qa_exit();
}

It's a little bit hacky but it should work.

...