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

How can I access all closed questions?

+3 votes
101 views
asked Oct 27 in Q2A Core by kksal55
How can I access all closed questions?

Thank you for your answer.
Q2A version: 1.8

1 Answer

+2 votes
answered Oct 27 by pupi1985
selected Oct 30 by kksal55
 
Best answer

I recently noticed there is a bug related to what a close question is.

A closed question should be either:

  1. A question that has been explicitly closed
  2. If the Close questions with a selected answer setting is enabled, a question that has a selected answer

In some parts of the core, a closed question is taking into account both conditions but in general only the first one is taken into account.

So, if you have have not enabled the Close questions with a selected answer setting, then just run this query:

SELECT * FROM `qa_posts`
WHERE `type` LIKE 'Q%' AND `closedbyid` IS NOT NULL

If you have enabled that setting then run this query:

SELECT * FROM `qa_posts`
WHERE `type` LIKE 'Q%' AND (`closedbyid` IS NOT NULL OR `selchildid` IS NOT NULL)

In both cases, if you want to get just a column with the URL, rather than just all the raw data, you can do something like this (then add the appropriate WHERE conditions based on the previous SQL statements):

SELECT CONCAT(
        (SELECT `content` FROM `qa_options`WHERE `title` = 'site_url' ),
        `postid`
    ) `url`,
    `qa_posts`.*
FROM `qa_posts`
WHERE ...

commented Oct 30 by kksal55
I close the questions I see incorrectly on my site. I edit those questions then when I'm available. I can do my job faster if I can access all the closed questions.
commented Oct 30 by pupi1985
I see. So it is not really needed for the average user of your site to actually access that. As long as you have the links to view them later that's it.
...