Okay.. I'm still back at this porblem.
I'm still not sure about the magic from getting from:
<form action="{xen:link 'forums/add-thread', $forum}" method="post"
class="xenForm Preview AutoValidator"
data-previewUrl="{xen:link 'forums/create-thread/preview', $forum}"
data-redirect="on"
>
<input type="text" name="myparam" value="default" />
</form>
to the file ControllerPublic_Forum_actionAddThread . Why is it sent to this file, and how can you tell (apart from the names sounding similar)
I've written some nasty hacks to work around my lack of knowledge in this area, the plug-in works, but I'm now trying to figure out how to do it the right way... As yet, I have no idea.
From what I can dig into, (trying to work forwards, and backwards to point out my gap in knowledge)
1) On clicking the create thread buttons, all of the hidden (and visible) params get submitted (via POST), and they are sent to: "forums/add-thread"
Params:
title=test&message_html=<p>test</p>&_xfRelativeResolver=http//
www.yourforum.co.uk/forums/forumname/create-thread&attachment_hash=<some uuid> &watch_thread_state=1&discussion_open=1&_set[discussion_open]=1&_set[sticky]=1&poll[question]=&poll[responses][]=&poll[responses][]=&_xfToken=<a bunch of uuids>&_xfRequestUri=/forums/forumname /create-thread&_xfNoRedirect=1&_xfToken=<a bunch of uuids>&_xfResponseType=json
(on creation .. so this should be at the end) The JSON
response is:
{"_redirectStatus":"ok","_redirectTarget":"\/threads\/test.196\/","_redirectMessage":"Your thread has been posted."}
2) forums/add-thread must have some sort of mechanism to get to the required class, after all, there is no such file as "forums/add-thread" ... so where exactly does this request go? It must go somewhere
3)... <gap in knowledge>
4)... <gap in knowledge>
5)... <gap in knowledge>
6) the public function actionAddThread() is found in the file Forum.php, with a Class and location: XenForo_ControllerPublic_Forum, this class extends XenForo_ControllerPublic_Abstract
7) This function actionAddThread() grabs all of the params and puts them into a filtered array:
Code:
$input = $this->_input->filter(array(
'title' => XenForo_Input::STRING,
'attachment_hash' => XenForo_Input::STRING,
'watch_thread_state' => XenForo_Input::UINT,
'watch_thread' => XenForo_Input::UINT,
'watch_thread_email' => XenForo_Input::UINT,
'_set' => array(XenForo_Input::UINT, 'array' => true),
'discussion_open' => XenForo_Input::UINT,
'sticky' => XenForo_Input::UINT,
'poll' => XenForo_Input::ARRAY_SIMPLE, // filtered below
));
it seems to do this by using " $this->_input"
8) XenForo_ControllerPublic_Abstract extends XenForo_Controller
9) _input is a protected object of XenForo_Controller
(some how, in step 3/4/5 all the POST data has already been added to this _input object)
10) This then all gets stuffed into a few objects, errors are checked and this all get stuffed into the $writer object (sorry for over simplifying), if no errors, this gets saved
$writer->save();
and a response is returned:
Code:
return $this->responseRedirect(
XenForo_ControllerResponse_Redirect::SUCCESS,
$return,
new XenForo_Phrase('your_thread_has_been_posted')
);
11) At this point, the response is sent back to the form (who is sitting patiently, waiting for an ajax response) and the response is handled accordingly (it returns to the return target as defined in point 1)
-----
All this to say, I don't understand when a GET/POST is submitted, how it is possible to work out where it goes, and how the protected _input is populated (and hence I cant build my own GET/POST handler right now)