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

How to have "close as duplicate" as default behaviour on closing a question?

What do I have to change in qa-page-question-view.php? Or somewhere else?

What about the javascript that displays the duplicate (default) after clicking on "duplicate".

Thanks!

Q2A version: 1.5.3

1 Answer

+1 vote
by
edited by
 
Best answer

In function qa_page_q_close_q_form(...) in qa-page-question-post.php, change this line:

'value' => @$in['duplicate'],

... to ...

'value' => @array_key_exists('duplicate', $in) ? $in['duplicate'] : true,

by
Did not solve it, I am still getting the php error message "The second argument should be either an array or an object".
by
As I see, from qa-page-question.php line 254 you are calling the function:

$qa_content['q_view']['c_form']=qa_page_q_close_q_form($qa_content, $question, 'close', @$closein, @$closeerrors);

However, nowhere $closein is defined? (which gets $in in qa-page-question-post.php, above.
by
OK, try adding an @ sign to before array_key_exists(...).

On your other point, $closein is defined in qa-page-question-post.php which is included by qa-page-question.php when appropriate.
by
ah okay, that was invisible to my text search :)

Thanks, that worked:
'value' => @array_key_exists('duplicate', $in) ? $in['duplicate'] : true,

(just edit your answer in case others change that too, thanks gid!)
...