Originally posted by bira
How to install:
Open
private.php
1) First we need to move "newmessage" after "dosend". Highlight the entire section between:
Code:
// ############################### start new message ###############################
Until (but not including):
Code:
// ############################### start send message ###############################
Cut this
entire section (a total of 83 lines in 2.2.1) and paste it right above:
Code:
// ############################### start do stuff (move, etc) ###############################
2) Now we need to insert the following code:
a) Find:
Code:
$savecopy=iif($savecopy=="yes",1,0);
Right under it insert:
Code:
// preview hack
$pmreceipt=iif($pmreceipt=="yes",1,0);
// preview hack
b) Find:
Code:
if ($pmquota>0 and $touserinfo[usergroupid] != 6 and $bbuserinfo[usergroupid] != 6) {
Right above it insert:
Code:
// preview hack
if ($preview) {
$previewpost=1;
$previewmessage=bbcodeparse($message,0,$allowsmilie);
if ($signature) {
$post['signature'] = bbcodeparse($bbuserinfo['signature'],0,$allowsmilie);
eval("\$post[signature] = \"".gettemplate("postbit_signature")."\";");
$previewmessage.=$post['signature'];
}
eval("\$postpreview=\"".gettemplate("priv_sendpreview")."\";");
$parseurlchecked=iif($parseurl,"checked","");
$pmreceiptchecked=iif($pmreceipt,"checked","");
$savecopychecked=iif($savecopy,"checked","");
$signaturechecked=iif($signature,"checked","");
$previewchecked=0;
$title = htmlspecialchars($title);
$privatemessageid = $prevmessageid;
$forward;
$subject = $title;
$privmessage = $message;
$action="newmessage";
} else {
// preview hack
c) Find:
Right above it insert:
d) Find:
Code:
//show new message form
Right under it insert:
Code:
// preview hack
if (!$pagetext) {
// parse message for html if previewing
$message = htmlspecialchars($message); // Without this, a </textarea> in the message breaks the form on preview
}
// preview hack
e) Find:
Code:
if ($bbuserinfo[userid]!=0 and !$previewpost and $bbuserinfo[signature]!="") {
$signaturechecked="CHECKED";
}
Right under it insert:
Code:
// preview hack
if (!isset($parseurl)) {
$parseurlchecked="CHECKED";
}
if (!isset($savecopy)) {
$savecopychecked="CHECKED";
}
if (!isset($pmreceipt)) {
$pmreceiptchecked="CHECKED";
}
// preview hack
f) Find:
Code:
// /enhanced
eval("dooutput(\"".gettemplate("priv_sendprivmsg")."\");");
Right above it insert:
Code:
// preview hack
if (!isset($privmessage)) {
$privmessage = $message[message];
}
// preview hack
g) Find:
Code:
// enhanced
$receipt=iif($pmreceipt=="yes",1,0);
// /enhanced
And replace it with (the code to remove is marked in red):
Code:
// enhanced
$receipt=iif($pmreceipt,1,0);
// /enhanced
Save private.php and upload to server.
In the Administration control panel -> Templates
1) ADD template
priv_sendpreview and insert to it:
Code:
<br>
<table cellpadding="0" cellspacing="0" border="0" bgcolor="#555576" width="100%" align="center"><tr><td>
<table cellpadding="4" cellspacing="1" border="0" width="100%">
<tr>
<td bgcolor="#8080A6"><smallfont color="#EEEEFF"><b>Message Preview:</b></smallfont></td>
</tr>
<tr>
<td bgcolor="#F1F1F1"><normalfont>$previewmessage</normalfont></td>
</tr>
</table>
</td></tr></table>
(you may edit this to your liking).
2) Open template
priv_sendprivmsg
a) place
$postpreview where you want the message preview to appear (normally would be under $cpnav).
b) Find:
Code:
<textarea name="message" rows="20" cols="$textareacols" wrap="virtual" tabindex="3">$message[message]</textarea>
And replace it with (change marked in red):
Code:
<textarea name="message" rows="20" cols="$textareacols" wrap="virtual" tabindex="3"> $privmessage</textarea>
c) Find:
Code:
<input type="checkbox" name="parseurl" value="yes" checked>
And replace it with (change marked in red):
Code:
<input type="checkbox" name="parseurl" value="yes" $parseurlchecked>
d) Find:
Code:
<input type="checkbox" name="savecopy" value="yes" checked>
And replace it with (change marked in red):
Code:
<input type="checkbox" name="savecopy" value="yes" $savecopychecked>
e) Find:
Code:
<input type="submit" class="bginput" name="submit" value="Send Message" accesskey="s" tabindex="4">
And replace it with (change marked in red):
Code:
<input type="submit" class="bginput" name="submit" value="Send Message" accesskey="s" tabindex="4">
<input type="submit" class="bginput" name="preview" value="Preview Message" accesskey="p" tabindex="4">
3) Open template
priv_requestreceipt
Find:
Code:
<input type="checkbox" name="pmreceipt" value="yes" checked>
And replace it with (change marked in red):
Code:
<input type="checkbox" name="pmreceipt" value="yes" $pmreceiptchecked>
That's it!
Comments and additions welcome.
Cheers,
Bira