January 11, 2004

Add Quick Reply phpBB hack to MT.

Posted at 02:28 AM Gems, Notebook, Too Done List


I've already got this simple but elegant hack working in phpBB. Now it's just a matter of porting it to my MT installation.


Done! Want to know how to do it yourself? Read on! (Note: This MT add-on assumes you've already installed the fluffyblog Using phpBB as your MovableType comment engine in 23847392 easy steps tutorial to your MovableType installation.

Once you've installed the above hack to your phpBB installation, it's a fairly simple matter to install it in your MT archives.

  • First, you need to have fluffyblog's display code installed, so download this php include file to your phpBB root directory.
  • Now open the file, and find the lines:

    echo "<div class=\"comments-footer\">";
    if ($display_userdata && $display_userdata['session_logged_in'])
  • Insert the following code above the lines.
    // Quick Reply Mod
    if ( $can_watch_topic && $is_watching_topic )
    	$notify = 1;
    	$notify = $display_userdata['user_notify'];
    $quick_reply_form = "
    <script language='JavaScript' type='text/javascript'>
    function checkForm() {
    formErrors = false;
    document.post.message.value = '';
    if (document.post.input.value.length < 2) {
    	formErrors = 'Can't post an empty comment!';
    if (formErrors) {
    	return false;
    } else {
    	if (document.post.quick_quote.checked) {
    	document.post.message.value = document.post.last_msg.value;
    	document.post.message.value += document.post.input.value;
    	return true;
    if ($display_userdata['session_logged_in'])
    	$quick_reply_form .= "<form action='" . append_sid($phpbb_root_path . 
    	"posting.php") . "' method='post' name='post' onsubmit='return 
    	<span class='genmed'><b>Comment:</b><br />";
    	$quick_reply_form .= "<textarea name='message' rows='10' cols='50' 
    	class='post'></textarea><br />
    	<input type='hidden' name='quick_quote' /> 
    	<input type='checkbox' name='attach_sig' checked='checked' />Attach Signature 
    	(signatures can be changed in profile)<br />
    	<input type='hidden' name='mode' value='reply' />
    	<input type='hidden' name='sid' value='" . $display_userdata['session_id'] . "' />
    	<input type='hidden' name='t' value='" . $thread_id . "' />
    	<input type='hidden' name='input' value='OOPS!' />
    	<input type='hidden' name='notify' value='" . $notify . "' />
    	<input type='submit' name='preview' class='liteoption' value='Preview' />&nbsp;
    	<input type='submit' name='post' class='mainoption' value='Submit' />
    echo $quick_reply_form;
    // END Quick Reply Mod
  • Now, in MT, open the archive template you wish to display the quick comment form in and insert the following code at the very top of the template:
    	include_once($phpbb_root_path . 'integrate.inc');
    	include_once($phpbb_root_path . 'forumfuncs.inc');
    	include_once($phpbb_root_path . 'mods/phpbb_fetch_all/common.' . $phpEx);
    	include_once($phpbb_root_path . 'mods/phpbb_fetch_all/posts.' . $phpEx);
    	# Note that because of this, this must be included before any HTML is output
    	  $display_userdata = session_pagestart($user_ip, PAGE_INDEX);
      <!-- END phpBB comment engine insert -->
  • Also, place the following code where you want your comments and comment form to appear in your template:
    	$thread_id = <$MTInclude module="GetForum"$>;
  • Don't forget to remove the old phpBB comments display from that template! Otherwise, you'll see the phpBB comments displayed twice!
That should do it. Save, Rebuild, Etc. and, so long as you're currently logged in to phpBB, you should see a quick comment form.

p. Posted by Patrick at January 11, 2004 02:28 AM