![]() |
OK, I wrote this hack seeing as my users were nagging about it and I could not find one here (if there is one, I apologise - please give me the URL).
This works exactly like post preview: http://www.atlasf1.com/personal/bira/privmsgpreview.gif How to install: Open private.php 1) First we need to move "newmessage" after "dosend". Highlight the entire section between: Code:
// ############################### start new message ############################### 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) ############################### a) Find: Code:
$savecopy=iif($savecopy=="yes",1,0); Code:
Code:
if ($pmquota>0 and $touserinfo[usergroupid] != 6 and $bbuserinfo[usergroupid] != 6) { Code:
Code:
} #end dosend Code:
Code:
//show new message form Code:
Code:
if ($bbuserinfo[userid]!=0 and !$previewpost and $bbuserinfo[signature]!="") { Code:
Code:
// /enhanced Code:
g) Find: Code:
// enhanced Code:
// enhanced Save private.php and upload to server. In the Administration control panel -> Templates 1) ADD template priv_sendpreview and insert to it: Code:
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> Code:
<textarea name="message" rows="20" cols="$textareacols" wrap="virtual" tabindex="3"> $privmessage</textarea> Code:
<input type="checkbox" name="parseurl" value="yes" checked> Code:
<input type="checkbox" name="parseurl" value="yes" $parseurlchecked> Code:
<input type="checkbox" name="savecopy" value="yes" checked> Code:
<input type="checkbox" name="savecopy" value="yes" $savecopychecked> Code:
<input type="submit" class="bginput" name="submit" value="Send Message" accesskey="s" tabindex="4"> Code:
<input type="submit" class="bginput" name="submit" value="Send Message" accesskey="s" tabindex="4"> 3) Open template priv_requestreceipt Find: Code:
<input type="checkbox" name="pmreceipt" value="yes" checked> Code:
<input type="checkbox" name="pmreceipt" value="yes" $pmreceiptchecked> Comments and additions welcome. Cheers, Bira |
Sorry, forgot to attack the instructions in a txt file as well (the same instructions as posted above).
|
bira, in the attached text file, you left a [/code] in. :o
It's in this part: PHP Code:
|
:o
fixed, thanks |
Not that I think anyone managed to install this hack so fast, but just in case - I made the following change to the above hack installation instructions:
In the private.php: Quote:
|
[QUOTE]Originally posted by bira
Not that I think anyone managed to install this hack so fast, but just in case... |
Thanks :)
|
If you haven't installed the hack, ignore this message -- the installation instructions in the first thread and the downloadable attachment txt file have been modified.
I've had a bug on my BB after installing this hack, so if anyone who installed this hack experiences the same problem, here's the fix: Problem: even if you select the option to "request read receipt", the PM doesn't appear in the message tracking page. Fix: in private.php find: Code:
// enhanced Code:
// enhanced |
After reading your message, I tested, and found I had the same problem. Your fix works fine. But I have to wonder, since it looks like this isn't part of your hack code, but rather part of the original code...does this fix have any other side effects?
|
JJR512 it shouldn't.
There is no difference as far as the private.php script goes between $pmreceipt=="yes" and just $pmreceipt not NULL. For some reason, the preview hack alters the "yes". But it's still either NULL (empty) or not (has value). So, the original code does: Code:
if ($pmreceipt=="yes") { Code:
if ($pmrecepit) { //does $pmreceipt have a value? Cheers, Bira |
A-ha!!!!
Silly me, I found the culprit :blush: In the hack details, I have the following code added: Code:
// preview hack In any event, doing this fix will NOT harm your script. |
OK, I think it makes sense. :)
BTW, I just noticed that the name of this hack doesn't really suit what it does..."Preview Sent Private Message"...you haven't really sent the message yet, when you preview it. ;) |
yeah, it should have been 'Preview Private Message before Sending' -- but I can't change it :/
|
If you haven't installed the hack, ignore this message -- the installation instructions in the first thread and the downloadable attachment txt file have been modified.
ok, found - and corrected - another bug. Problem: if you are replying to a PM or forwarding it, the icon in the folder for that PM does not change from a regular "read PM" to a "replied to PM" or a "forwarded PM". The reason is that if you preview a message, the values for "privatemessageid" and "forward" -- hidden fields in the form -- are not stored. For this, we have to redclare them in the 'preview' part of the hack. If you already installed this hack, find in private.php: Code:
$subject = $title; Code:
$privatemessageid = $prevmessageid; |
Love it, installed here. :D
Thanks. :) |
wow, thanks :)
|
Thank you. :)
One problem though, with this code: Code:
$privatemessageid = $prevmessageid; So I had to remove that bit for now, let us when you get a fix. :) (and sorry about my test message :D) |
FireFly, you shouldn't remove it. I'll explain:
In the send new pm form, there are two hidden fields (original code): Code:
<input type="hidden" name="prevmessageid" value="$privatemessageid"> if $privatemessageid has a value, then it means you are now replying to or forwarding a message. If it doesn't have a value, it means you are writing a new message. if $privatemessageid has a value and $forward=1, it means you are forwarding a message and not replying. These then determine which icon will be displayed in your inbox next to that message. Now, when you click on "Reply" for a message, these values are filled. When you hit "Preview", these values are lost. So we need to "reinstate" them. That's what these two lines are for: Code:
$privatemessageid = $prevmessageid; For the vast majority of the people, that error won't show up because they are not in development environment with high error reporting, and functionality is not tampered. However, if you want to be "holier than the pope" so to speak, do this instead: PHP Code:
Cheers, Bira |
[QUOTE]Originally posted by bira
From what you are telling me, I can only assume you have high error reporting set in php.ini. |
OKay.. I have installed this as well and come across another pecularity.
If you look in private.php in the "New Message" section there is this line: PHP Code:
PHP Code:
|
Thanks wluke, good to know
|
[QUOTE]Originally posted by bira
However, if you want to be "holier than the pope" so to speak, do this instead: PHP Code:
Cheers, Bira |
Ok I press preview, and the page refreshes with nothing but a new blank priv message...
help!? :( |
LuBi, follow the instructions again and see what you missed out or did wrong
|
From what I can see I have installed everything correctly, my only problem was that copy and paste part but the problem was no with what I did but that it was interesting ;) anyhow.. now my only worry is when I pree preview it's more like a refresh button and the page comes back blank, exactly what happened before so nothing has changed. I have this hack installed with the jscript hack similar to what firefly runs on here.. but for some reason my preview doesn't work...
|
<<help>>
|
LuBi, I honestly don't know how to help you.
If you installed the hack exactly as the instructions say then you shouldn't have any problem. Your problem, from what you are describing, is that the action 'preview' is either not present in private.php, or misconfigured. If the page simply refreshes, it means it doesn't know what to "do" with 'preview'. That means you installed the hack wrongly. |
Ok well that was funny I missed $postpreview 5 times. Now my problem wil be getting this hack to work with the javascript hack. I think I just need to change this $privmessage for $message[message] and I'll be so fresh so clean. THANKS! :D
*Edit - Works now with the javascript hack, my mistake $privmessage had an extra e i.e. $privmessagee Thanks Again! |
I tried installing twice. and this is what I get printed on screen above my headers
(part of my VB title) Private Messaging - Send Message then I get the screen to send PM and underneath it printed on the screen HTTP/1.1 200 OK Date: Mon, 24 Dec 2001 04:29:14 GMT Server: Apache/1.3.19 (Unix) PHP/4.0.5 mod_ssl/2.8.2 OpenSSL/0.9.6 X-Powered-By: PHP/4.0.5 Content-Length: 5331 Keep-Alive: timeout=15, max=97 Connection: Keep-Alive Content-Type: text/html and then the vbulletin error message no private message specified... ??? |
Stupid me instead of cutting and pasting I did a copy and paste... However I cannot preview. I still am getting the no message specified error....
I applied wluke's fix if (isset($privatemessageid) and $privatemessageid!=0) { and it is working now. Thanks for the hack Bira. |
Woah! That's what I call a HACK! Many thanks *again* bira! :D
Now could you make a preview when editing posts? ;) |
Liking this hack! Thanks:)
One thing though. How can I modify the preview so that the text will use up more than what it is using now. I am only using 1/3 of the potential screen I could be using. Any ideas? |
Bira I have a small problem with that hack:
when I do:priv_sendprivmsg $message[message] And replace it with: $privmessage that does not include the quotes when I reply. When I do: $message[message] $privmessage that include the quotes but in the new text box if you want to preview, it displays it twice. How can I fix? never mind... I was missing a line in private php if (!isset($privmessage)) { $privmessage = $message[message]; } |
Just wanted to note that you seem to loose the subject when you preview a private message.
|
hi bira,
ich just installed it and its working fine exept in the preview the formating is not taken over (ie. [quote] ist icons etc. are not converted). Any Idea what i might have done wrong - ive gone over the code serveral times and cant find the cause. Maybe it has something to do with my templates? regards tina |
Works great in 2.2.2
Thanks |
Great hack!
|
Great Hack Man! Keep up the good work.
|
Great Hack Bira! :)
I had to use the Wluke modification and it works fine, but when I click preview, selected icon is not selected anymore and smilies are not converted. |
Bira, I tried on another server and smilies are converted in preview. What could it be that on one server they are converted and on other are not? (on post preview I have non similiar problem)
|
All times are GMT. The time now is 11:04 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|