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

If you have questions about the platform, click here to ask and please use English.

If you just want to try Q2A, please use the demo, which also grants admin access.

Apr 29: Q2A 1.5.2

v1.5: Move answer form to the bottom via theme or option?

+3 votes

If I have the option "Show answer form immediately" ticked it shows the answer form at the top of the page, whereas in 1.4 it showed underneath the answers. I find that's better because users should clearly read through the existing answers before adding their own.

The only way I've found to change this is in the core (as in the related question). Any theme method? Could it be moved in the next version (or an option to do this)?

Q2A version: 1.5-beta1
asked Dec 27, 2011 in Q2A Core by DisgruntledGoat
closed Jan 23 by DisgruntledGoat

1 Answer

+2 votes
It's funny how easy this actually is... I must be spending too much time with this code :)

        function doctype()
        {
            qa_html_theme_base::doctype();
            if(isset($this->content['a_form'])) {
                $a_form = $this->content['a_form'];
                unset($this->content['a_form']);
                $this->content['a_form'] = $a_form;
            }
        }

All this does is send a_form to the end of the array, which causes it to show last.  There may be something it has to come before, but you can just unset and readd that as well, in the same way.
answered Dec 27, 2011 by NoahY
Ah, excellent... I figured it was a result of it being added to the array too early, but didn't realize it was so easy to move an element to the end of an associative array. Thanks, man!
EDIT: note, extra ) needed after the if clause :)
yw :) sorry, there was a typo, fixed now.