Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
465 views
in Q2A Core by
How to lock the question for accepting new answers after selection of best answer by user or moderator?

does this require lots of code changes?

1 Answer

0 votes
by
 
Best answer
This is fairly easy to do - add the following line before the end of the branch:

if (isset($question)) { ... }

at the end of qa_page_q_load_q() in qa-page-question.php:

$question['answerable']=$question['answerable'] && !isset($question['selchildid']);

The && is a logical AND so we're just adding another condition here on whether a question can be answered - the condition is that it has no selected answer.
by
$question['commentable']=$question['commentable'] && !isset($question['selchildid']);

this line still allows comments on best answer.
by
Gideon, How to fix this issue? thanks!
-------------
 $question['commentable']=$question['commentable'] && !isset($question['selchildid']);

this line still allows comments on best answer.
by
It's the same idea - inside this loop:

foreach ($answers as $key => $answer) { ... }

Insert the code:

$answers[$key]['commentable']=$answer['commentable'] && !isset($question['selchildid']);

I'm assuming here you want to prevent comments on all the answers.
by
yes, once best answer is selected then disable comments on all answers and question. only "ask related question" link should be there.

I guess this should fix the issue.
...