MyBB Community Forums

Full Version: Closing thread link
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
What am I missing from this URL to close threads? I keep getting an error.

moderation.php?action=openclosethread&modtype=thread&tid={$tid}&my_post_key={$mybb->post_code}
I guess you picked up the values from the Moderation Options to build your own link!?
That's not possible! These values are submitted via form by a POST method to moderation.php. Only GET methods can be converted to use as a link.
You definively need to use a form to open/close threads.

As a solution, you can build a form with all hidden input elements and a button that can ba formatted lto look like a link.
<form action="moderation.php" method="post" style="display: inline">
	<input type="hidden" name="modtype" value="thread">
	<input type="hidden" name="tid" value="137">
	<input type="hidden" name="action" value="openclosethread">
	<input type="hidden" name="my_post_key" value="{$mybb->post_code}">
	<input type="submit" value="{$lang->open_close_thread}" >
</form>

[ExiTuS]
Thanks for the reply Exitus.

In moderation.php variables are populated from $mybb->get_input

Eg:
$tid = $mybb->get_input('tid', MyBB::INPUT_INT);
$pid = $mybb->get_input('pid', MyBB::INPUT_INT);
$fid = $mybb->get_input('fid', MyBB::INPUT_INT);
$pmid = $mybb->get_input('pmid', MyBB::INPUT_INT);
$modal = $mybb->get_input('modal', MyBB::INPUT_INT);
$mybb->input['action'] = $mybb->get_input('action');


Is $mybb->get_input POST only? I thought they were also use for GET vars.

Ahhh found this line:

Line 135
if($mybb->request_method != "post" && !in_array($mybb->input['action'], $allowable_moderation_actions))
{
error_no_permission();
}


$mybb->request_method != "post" is really not needed?

Is there any reason to lock down inputs to POST?

Temp fix....

Hook: moderation_start
$mybb->request_method = 'post';