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";
}