Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+5 votes
in Q2A Core by
recategorized by

I found the answer here: http://question2answer.org/qa/13147/can-exclude-closed-questions-from-unanswered-questions-list

in “qa-include/qa-db-selects.php” function “qa_db_unanswered_qs_selectspec” change line: $bysql='acount=0';
to: $bysql='acount=0 AND closedbyid IS NULL';

But after closing a question nobody is able to answer it. Thus, it does not make sense to keep it in the unanswered questions list.

+1 if you agree


Edit: Same goes for "No selected Answer" and "No upvoted answer" lists. Closed questions should be excluded.

Q2A version: 1.5.1

1 Answer

+4 votes

This is how function qa_db_unanswered_qs_selectspec has to be changed accordingly:

switch ($by) {
    case 'selchildid':
        // $bysql='selchildid IS NULL';
        $bysql='selchildid IS NULL AND closedbyid IS NULL';
    case 'amaxvote':
        // $bysql='amaxvote=0';
        $bysql='amaxvote=0 AND closedbyid IS NULL';
        // $bysql='acount=0';
        $bysql='acount=0 AND closedbyid IS NULL';


This will work fine, but please note that this makes the queries for the unanswered page not fully indexed. Won't matter for the first page, but might matter for the 1000th, e.g. if retrieved by a search engine.
Thanks for pointing out the search engine issue.

Well, I am using the closed feature only for closing and hiding "old news" from the list. So that's fine in my case.