Open Questions Plugin for Question2Answer Q&A Platform
I use the Questions2Answer Q&A platform (Q2A) for Telerik Software Academy forums. It is great discussion board implemented in the “stackoverflow” style: questions with answers and comments, tags and categories, voting and gamification with a score system and a leaderboard.
One feature missing in Q2A is displaying the open unanswered questions. There is a similar feature called “Unanswered Questions” but it is useless because it shows the closed questions without answer. This is strange. Once a question is closed, this means its answer has been found by its author or the question is found to be duplicate or spam or irrelevant to the forum and should never be answered. Most Q&A users agree that all closed questions should be considered answered and not shown as “waiting an answer”.
Fixing the “Unanswered” Page in Q2A
The easiest way to fix the “Unanswered” questions page to exclude the closed questions is to change the line
$bysql='acount=0 AND closedbyid IS NULL';
in the function “qa_db_unanswered_qs_selectspec” located in the file “qa-include/qa-db-selects.php”.
This ugly approach works but if you upgrade the Q2A software with a newer version, the fix will be lost. A better approach is to use a plug-in. It is not hard to write a plugin for Q2A platform because it is well written, structured and even documented and uses standard PHP and MySQL programming techniques and best practices.
Open Questions Plugin for Question2Answer
I created an open-source project in GitHub to host the “Open Questions” plugin for Q2A: https://github.com/nakov/q2a-plugin-open-questions. The plugin consists of 3 PHP files and it is relatively easy to understand how it works. The installation is trivial.
If you want to install it, just download the archive q2a-plugin-open-questions.zip and extract it into the “qa-plugin” directory of your Q2A installation and enable it through the Admin panel: