Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
652 views
in Q2A Core by
I have defined initially a category that can be visible by any person without being supposed to be logged in. Inside this category i have added 6 questions.
Then I have added other categories that can be visible only by the approved users of the forum.
Now, if I'm not logged in into the forum, and i will just go to the Questions tab i will see a blank page with the possibility to click on the second page. I'm clicking on the second page button and then i will see all my 6 questions there.

As of now I just have 2 pages of questions but if there will me bore questions added I will end up with the public questions on the 10-11-12-...-N page and all the pages before that one will be blank.

Is there a way to fix this issue? Can you please help me?

Q2A version: 1.8
Q2A version: 1.8
by
edited by
I have managed to fix it :) . Thanks again for your reply.
I have used your answer from  http://www.question2answer.org/qa/54987?show=54988#a54988 and i just added a condition if the user is logged in or not.

Below is the code i have used in selects.php into the qa_db_qs_selectspec function:

    if (qa_is_logged_in() && qa_get_logged_in_level() >= QA_USER_LEVEL_APPROVED) {
        $selectspec = qa_db_posts_basic_selectspec($voteuserid, $full);

        $selectspec['source'] .=
            " JOIN (SELECT postid FROM ^posts WHERE " .
            qa_db_categoryslugs_sql_args($categoryslugs, $selectspec['arguments']) .
            (isset($createip) ? "createip=UNHEX($) AND " : "") .
            "type=$ " . $sortsql . " LIMIT #,#) y ON ^posts.postid=y.postid";
    } else {
        $selectspec = qa_db_posts_basic_selectspec($voteuserid, $full);
       
        $hiddenCategoryIds = array(1, 2, 3, 4, 5, 6);
        $hideInPages = array('', 'activity', 'questions');
        if (in_array(qa_request(), $hideInPages) && !empty($hiddenCategoryIds)) {
            $sql = '(^posts.categoryid NOT IN (' . implode(',', $hiddenCategoryIds) . ') OR ^posts.categoryid IS NULL) AND ';
        } else {
            $sql = '';
        }
        $selectspec['source'] .= " JOIN (SELECT postid FROM ^posts WHERE " .
                $sql.
            qa_db_categoryslugs_sql_args($categoryslugs, $selectspec['arguments']) .
            (isset($createip) ? "createip=UNHEX($) AND " : "") .
            "type=$ " . $sortsql . " LIMIT #,#) y ON ^posts.postid=y.postid";
    }
by
Nice, thanks a lot for the answer
by
I updated the answer in order to replace " if (qa_is_logged_in())" with "if (qa_is_logged_in() && qa_get_logged_in_level() >= QA_USER_LEVEL_APPROVED)" because it seems the question list was not displayed correctly if a new user was not yet approved.
by
it seems i have same problem in the HOT page :( . Can somebody tell me what i should change and how to it in order to correctly display also there the questions?

Please log in or register to answer this question.

...