Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+9 votes
2.8k views
in Q2A Core by
How can I create a private installation of Q2A for use as a members only board?

In other words, I don't want guests/non-members to be able to see questions and answers.
by
Anyone have any idea on a workaround assuming this isn't a built in feature?

2 Answers

+1 vote
by

this should do the trick:

open qa-include/qa-app-users.php

search for $qa_logged_in_userid_checked=true;

add this:

if ((!@$_SESSION['qa_session_userid'])&&(!isset($_GET["x"]))){
  if ($_GET["qa"]=="register")
    qa_redirect_raw('index.php?qa=register&x');
  else
    qa_redirect_raw('index.php?qa=login&x');
}

 

now you'll get automatically redirected to the login page - if you're not logged in...

There is just one problem: unfortunately I can't read out the parameter "qa" at this place -- so new users are not able to register - also they will be redirected to login instead of to register page...
...and I don't know why...

Any hints from other users?

 

 

by
I am also facing the same issue ...any idea????
by
There seems to be issue because of this http://localhost/qa/?qa=register&to=%3Fqa%3Dlogin%26x%3D,....as qa is set to login again...

Please check
by
hey did ever figure it out? If yes could you please post the code?
by
Version 1.4 allows you to make questions viewable by registered users only.
by
It still allows to view questions just not answers. I want whole site to be restricted till users logs in.
+2 votes
by

Hi, 

Based on a previous answer from  snoopy0815 (and thank you btw) , here's a version of the trick working with version 1.6.3 : 

 

open qa-include/qa-app-users.php

search for $qa_logged_in_userid_checked=true;

add this:

if (

    (empty($_SESSION['qa_session_userid_'.$suffix]))

    && ($_REQUEST["qa-rewrite"]!="login")

    && ($_REQUEST["qa-rewrite"]!="register")){

              qa_redirect_raw('login');

 }

...