Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+6 votes
1.2k views
in Q2A Core by
I like how the answer box is there when you view a question without a answer. It would be nice if there was a way to have it be there on all questions. It would save a click.
by
It seems like removing this line in qa-page-question.php did the trick:
    if ((!$formrequested) && $question['answerable'] && (!$question['acount']) && (!$question['isbyuser']) )

But it is putting the box to answer the question above the answers already provided. Any idea how I could move it below the answers people already provided?
by
Good working find this! First I'd suggest you at least leave in these conditions:

if ((!$formrequested) && $question['answerable'] && (!$question['isbyuser']) )

In other words, just remove:

&& (!$question['acount'])

Otherwise other forms won't work, and you'll be shown the answer form even on hidden questions, or on your own question.

In terms of the output ordering, you need to modify the order in which the theme class outputs elements. Basically, you need to move this line from q_view_main(...) in qa-theme-base.php:

$this->form(@$q_view['a_form']);

And insert this line in question_main(...) after: $this->a_list();

$this->form(@$this->content['q_view']['a_form']);

If you want to increase the chance this will work in future versions of Q2A, do this using an advanced theme rather than modifying qa-theme-base.php.
by
Thank you.. I got this working. But I do have a couple more questions.

1. I would like to have the option to have it show on my own questions. Would removing && (!$question['isbyuser']) take care of that? I don't allow comments on answers so answers are the the only way to respond. I'm just not a fan of nesting. edit-- I checked and it worked.

2. Now when I answer it posts the answer but when the page reloads the answer box still has the contents of my answer. So if I hit the reload button it asks me if I want to resend data, and if I click yes it tells me that I am making a dupe (BTW, nice touch). Is there a easy fix for this? If not don't worry about it, you have done enough. If you want to see what it is doing you can see here. http://stfudamnit.com/
by
To stop the submitted answer appearing in the form again, add:

unset($incontent);

After this line in qa-page-question-post.php:

$answerid=qa_answer_create($qa_db, $qa_login_userid, $qa_cookieid, $incontent, $innotify, $inemail, $question);
by
Thank you. Now everything is working perfectly.

1 Answer

0 votes
by

This is in the Q2A core, now.

Go to Admin > Viewing > Show answer form immediately, set it to "Always".

...