MyBB Community Forums

Full Version: Add a "create new thread" form to portal
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want a create new thread form on my portal that posts to a single forum. This is my code so far.

<div id="quick_post_open" style="display:none">
<form method="post" action="newthread.php?fid=13&processed=1" name="quick_reply_form" id="quick_reply_form">
<input type="hidden" name="my_post_key" value="" />
<input type="hidden" name="removeattachment" value="">
<input type="hidden" name="fid" value="{$fid}">
<input type="hidden" name="posthash" value="{$posthash}">
<input type="hidden" name="action" value="do_newthread">
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="2"><b>Quick Thread:</b>
</td>
</tr>
<tr>
<td class="trow2" width="20%">Subject:</td>
<td class="trow2">
<input class="textbox" type="text" name="subject" size="52" maxlength="85" value="" tabindex="1" />
</td>
</tr>
<tr>
<td class="trow2" valign="top">
<br/>
</td>
<td class="trow2">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td colspan="2">
<textarea name="message" rows="8" cols="70" tabindex="3"></textarea>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
<input type="submit" value="Post" />
</form>

It returns
Quote:Authorisation code mismatch. Are you accessing this function correctly? Please go back and try again.
I assume this is because I haven't provided any security codes.

How can I do this?
refine this : <input type="hidden" name="my_post_key" value="" />
What do you mean refine?
It should be like;
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
Edit : not seen Yaldaram's response Smile

<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
Yep that works. It was originally like that, but I removed it because I assume it was a forum-specific thing (and I'm not on a forum page).

Thanks guys.
Nope, the post key verifies that it's you and not some CSRF hack Smile

Could you mark the thread as solved?
Done.

I must say, this answer marking and problem solved system is pretty good. I last used this forum a year or two ago when it wasn't here.
Well, thank MattRogowski for that Smile