Quick Reply

##############################################################
## MOD Title: Quick Reply (JasonB)
## MOD Author: Smartor < smartor_xp@hotmail.com > (Hoang Ngoc Tu) http://smartor.is-root.com
## MOD Editor: Jason Bassford <jasonb@dante.com> https://jasonbassford.com/
## MOD Description: This will add a quick-reply form below every topics
##			It will only display when user has the Reply access
## MOD Version: 1.0
##
## Installation Level: Easy
## Installation Time: 5 Minutes
## Files To Edit: 3
##	viewtopic.php
##	language/lang_english/lang_main.php
##	templates/subSilver/viewtopic_body.tpl
## Included Files: N/A
##############################################################
## Author Notes:
##
##############################################################
## This MOD is released under the GPL License.
## Intellectual Property is retained by the MOD Author(s) listed above
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]------------------------------------------
#
$template->pparse('body');

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

#
#-----[ BEFORE, ADD ]------------------------------------
#
//
// Quick Reply Mod
//
if ( ((!$is_auth['auth_reply']) or ($forum_topic_data['forum_status'] == FORUM_LOCKED) or ($forum_topic_data['topic_status'] == TOPIC_LOCKED)) and ($userdata['user_level'] != ADMIN) )
{
	$quick_reply_form = "";
}
else
{
	if ( $can_watch_topic && $is_watching_topic )
	{
		$notify = 1;
	}
	else
	{
		$notify = $userdata['user_notify'];
	}
	$bbcode_uid = $postrow[$total_posts - 1]['bbcode_uid'];
	$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 = '" . $lang['Empty_message'] . "';
			}
			if (formErrors) {
				alert(formErrors);
				return false;
			} else {
				document.post.message.value += document.post.input.value;
				return true;
			}
		}
	</script>
	<tr>
		<th class='thLeft' nowrap='nowrap'>".$userdata['username']."</th>
		<th class='thRight' nowrap='nowrap'>".$lang['Quick_Reply']."</th>
	</tr>
	<form action='".append_sid("posting.$phpEx")."' method='post' name='post' onsubmit='return checkForm(this)'>
        <tr><td class='row1' style='padding-top: 10px; padding-left: 5px; padding-right: 5px' valign='top'><span class='genmed'>";

	if (!$userdata['session_logged_in'])
	{
		$quick_reply_form .= $lang['Quick_Username'] . ":<p><input class='post' type='text' name='username' size='20' maxlength='25' value='Guest' /><p>";
	}

	$quick_reply_form .= $lang['Quick_Instructions']."</span></td>
	<td class='row2'>
	<textarea name='input' style='width: 100%' rows='10' wrap='virtual' class='post''></textarea><br />
	<input type='hidden' name='mode' value='reply' />
	<input type='hidden' name='sid' value='" . $userdata['session_id'] . "' />
	<input type='hidden' name='t' value='" . $topic_id . "' />
	<input type='hidden' name='message' value='' />
	<input type='hidden' name='notify' value=" . $notify  . " />
	<input type='hidden' name='attach_sig' value='checked' />
	<input type='submit' name='preview' class='liteoption' value='".$lang['Preview']."' /> 
	<input type='submit' name='post' class='mainoption' value='".$lang["Submit"]."' />
	</td></tr></form>";
}

$template->assign_vars(array(
	'QUICK_REPLY_FORM' => $quick_reply_form)
);
//
// END Quick Reply Mod
//

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------
#
//
// That's all Folks!

#
#-----[ BEFORE, ADD ]------------------------------------
#
// Quick Reply Mod
$lang['Quick_Reply'] = 'Quick Reply';
$lang['Quick_Instructions'] = 'If you have a signature, it will be automatically added to your post.<p>Click on "Preview" to change this post\'s options.';
$lang['Quick_Username'] = 'Username for post';

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewtopic_body.tpl

#
#-----[ FIND ]------------------------------------------
#
	<!-- END postrow -->

#
#-----[ AFTER, ADD ]------------------------------------
#
		{QUICK_REPLY_FORM}

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM

Leave a Reply