Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Private Q&A?

+9 votes
2,082 views
asked Apr 2, 2011 in Q2A Core by gatorfan
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.
commented Apr 3, 2011 by gatorfan
Anyone have any idea on a workaround assuming this isn't a built in feature?

2 Answers

+1 vote
answered Apr 4, 2011 by snoopy0815

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?

 

 

commented Jul 24, 2011 by gidgreen
Version 1.4 allows you to make questions viewable by registered users only.
commented Jul 24, 2011 by marcink99
It still allows to view questions just not answers. I want whole site to be restricted till users logs in.
+2 votes
answered Dec 2, 2014 by kourryel

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');

 }

...