MyBB Community Forums

Full Version: Custom quick reply for portal
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

at the moment i'm busy with a portal system. It also features a single news item view which also shows all replies on that news item.

It would ofcourse be nice if a user can do a quick reply.
(Login stuff is already taken care off)

So what I tried is checking out the quick reply code of myBB.
By removing the extra options, I gained a small clean form which let me submit a reply to the specified topic (newsitem).

The only problem is that after posting it the reply, it returns to the forum (and it's post there). I would like to see it forwarding to a specified page on the portal.

So this is what I got (which works but forwards wrong):
<!-- start: showthread_quickreply -->
<form method="post" action="/forums/newreply.php" name="input">
<input type="hidden" name="subject" value="RE: SUBJECT" />
<input type="hidden" name="action" value="do_newreply" />
<input type="hidden" name="tid" value="4" />
<table id="quick_reply">
<thead>
<tr>
<td class="thead">
<div><strong>Quick Reply</strong></div>
</td>
</tr>
</thead>
<tbody style="" id="quickreply_e">
<tr>
<td class="trow1" valign="top">
<strong>Message</strong><br />
<span class="smalltext">Type your reply to this message here.<br /><br />
</td>
<td class="trow1"><textarea name="message" rows="7" cols="70" wrap="virtual" tabindex="1"></textarea></td>
</tr>
<tr>
<td colspan="2" align="center" class="tfoot"><input type="submit" class="submit" 
value="Post Reply" tabindex="2" accesskey="s" />
<input type="submit" class="submit" name="previewpost" value="Preview Post" tabindex="3" /></td>
</tr>
</tbody>
</table>
</form>
<!-- end: showthread_quickreply -->

I even tried setting the value (before the form is showed) location in mybb_sessions but doesn't helps.
Open newreply.php
Find:
$url = "showthread.php?tid=$tid&pid=$pid#pid$pid";
Replace with:
if(isset($mybb->input['url']))
{
	$url = $mybb->input['url'];
}
else
{
	$url = "showthread.php?tid=$tid&pid=$pid#pid$pid";
}

And then in your forum add something like:
<input type="hidden" name="url" value="../myportal.php?tid=4" />