PDA

View Full Version : Remove Extra Quotes From PMs


Raz
07-14-2002, 10:00 PM
Heres a quickie hack that will remove any extra quotes from PMs when you reply to them.

It will save you (and your users) time from deleting them yourself and also reduce the size of your PM Db :D

Example:
The first quoteThe third quote (and so on)...The second quote
becomesThe first quote

OK open up 'private.php' in your favourite editor then goto line 542, which should have: eval("\$message[message] = \"".gettemplate("priv_reply",1,0)."\";");
} else {
$message = array();
}
and just above that place this $message[message] = trim(preg_replace("~\[quote\](.*)\[/quote\]~si", "", $message[message]));
Its as easy as that!

Enjoy!
Raz

Boofo
07-14-2002, 11:45 PM
It took out ALL of the quotes. Can it leave just the last one when you reply to the message? Also, it placed a W] inside the quote that was there but nothing else.

Velocd
07-15-2002, 12:20 AM
Yes, I have to also agree with Boofo, just leaving the last QUOTE is the best method :D

I hate those annoying quotes having to delete them, so this is a good idea with the small change.

Raz
07-15-2002, 08:07 AM
Umm...did you follow the code *exactly* as I said? i.e. place the new code *above* the eval code?

I've tested it out on my own forums and is working great.

Admin
07-15-2002, 08:17 AM
Hmm, shouldn't the code be...
$message['message'] = trim(preg_replace('~\[quote\](.*)\[/quote\]~si', '', $message['message']));

Boofo
07-15-2002, 08:23 AM
Thanks, Chen, you have once again proven yourself worthy to be called the MASTER! That worked great! And it only leaves the current quote.

Sincerely,
Grasshopper

Originally posted by FireFly
Hmm, shouldn't the code be...
$message['message'] = trim(preg_replace('~\[quote\](.*)\[/quote\]~si', '', $message['message']));

Raz
07-15-2002, 09:45 AM
*sigh* That is what I tried to post, but alas was parsed incorrectly...

[edit]
Yup, the "stupid" board strips out any slashes from code.

Boofo
07-15-2002, 09:52 AM
Can't you just attach it as a text file attachment? :) Or just use the tags.

Originally posted by Raz
*sigh* That is what I tried to post, but alas was parsed incorrectly...

[edit]
Yup, the "stupid" board strips out any slashes from code.

Logician
07-15-2002, 09:56 AM
nice hack Raz.. it is small but useful :)

Raz
07-15-2002, 09:59 AM
Originally posted by Boofo
Can't you just attach it as a text file attachment? :) Or just use the tags.

Nah its fine, I've fixed the original post.

Just used a \\\\[ to get a \[ :rolleyes:

Boofo
07-15-2002, 10:06 AM
You really ought to try the disable codes sometime. That has got to be my favorite hacks of all time. Chen has it working here. :) It sure saves a lot of headaches and parsing problems.

Originally posted by Raz
Nah its fine, I've fixed the original post.

Just used a \\\\[ to get a \[ :rolleyes:

Raz
07-15-2002, 10:06 AM
Originally posted by Logician
nice hack Raz.. it is small but useful :) Yup, its one of those hacks that should have been included with VB in the first place.

Raz
07-16-2002, 11:27 AM
Originally posted by Boofo
You really ought to try the disable codes sometime. That has got to be my favorite hacks of all time. Chen has it working here. :) It sure saves a lot of headaches and parsing problems.

It has nothing to do with BBCode, but the way it handles slashes (\)

Boofo
07-16-2002, 11:30 AM
Yes, but it worked fine for Chen and I when we used it. :)

Originally posted by Raz
It has nothing to do with BBCode, but the way it handles slashes (\)

Raz
07-16-2002, 11:33 AM
Chen used the tag. The problem with slashes seems to be when using the tag. :)

Admin
07-16-2002, 11:37 AM
Originally posted by Raz
Chen used the tag. The problem with slashes seems to be when using the tag. :)
Yup, I noticed that as well and trying to fix that bug.

Raz
07-16-2002, 11:51 AM
The problem may actually lay with the highlight_string() function.

Possibly doing a highlight_string(str_replace('\\', '\\\\', $data)) might fix it.

Boofo
07-16-2002, 11:53 AM
You're right. I didn't try that. Strange that it would work fine for the code tags and not PHP. :)

Originally posted by Raz
Chen used the tag. The problem with slashes seems to be when using the tag. :)

Raz
07-16-2002, 11:55 AM
The only difference between those two 'quotes' is that the [php] tag makes use of the highlight_string().

Presumely its strips out any slashes it sees.

Admin
07-16-2002, 12:09 PM
Let's see if I managed to fix this...

$message[message] = trim(preg_replace("~\[quote\](.*)\[/quote\]~si", "", $message[message]));

Boofo
07-16-2002, 12:22 PM
Ok, looks like it worked! :) What do we need to change in the diable code hack to make it work like this?

aidler
07-16-2002, 12:25 PM
Ok I'm confused now. What's the correct code that should be inserted into privat.php???

Admin
07-16-2002, 12:31 PM
aidler: Use the code in the first post.

Raz
07-16-2002, 06:54 PM
I (and most others) always update the first post with the latest code changes :)

santeematt
07-17-2002, 03:45 PM
nice little addition.

XFLBret
11-28-2002, 04:47 AM
are you guys sure that it's private.php? i thought private was for the interface to access your PM's, and the actual PM view was another file.

i tried hacking this in, and my PM page got all asshurt and displayed a stupid error which is gone now.

i'll try again...

XFLBret
11-28-2002, 04:53 AM
Parse error: parse error in /usr/local/etc/httpd/htdocs/forums/private.php on line 879

there the error i get when i try to install this hack. what's the deal here?

NTLDR
11-28-2002, 09:04 AM
Make sure you have applied the code in the correct place and that its the correct code. This hack is working fine right up to 2.2.9.

XFLBret
11-28-2002, 09:14 AM
done and done...before I posted my complaint

OT: the girl in your avatar is quite beautiful. who is she?

Chris M
12-01-2002, 05:17 PM
This is cool - I totally forgot about the "disable" tag:D

Tee hee hee:p

=-=

Anyway - Nice - Thanks:)

Satan

Zelda-King
04-29-2003, 05:19 PM
Nice! It doesn't make any difference with quotes in the Quick PM Reply hack, however.

gmarik
05-18-2003, 02:51 PM
Is it working ok on 2.3.0 now?
I mean the first post?

Oblivion Knight
05-19-2003, 07:05 AM
Yesterday at 04:51 PM gmarik said this in Post #32 (https://vborg.vbsupport.ru/showthread.php?postid=396723#post396723)
Is it working ok on 2.3.0 now?
I mean the first post?

Yes, it's working perfectly on my 2.3.0 RC3 :)

julius
06-01-2003, 07:04 PM
Nice Hack, but when you forward a message containing "quote", the "quote" should remain all. Otherwise what forward is?

julius
06-08-2003, 09:26 AM
If you want to reply with the hack and to forward without the hack, you have instead to put the code$message[message] = trim(preg_replace("~\[quote\](.*)\[/quote\]~si", "", $message[message])); just under this $subject="Re: $message[title]";

Boofo
06-08-2003, 11:41 AM
Don't you mean to put it under this?

$subject="Fw: ".$message[title];

julius
06-08-2003, 12:45 PM
Today at 02:41 PM Boofo said this in Post #36 (https://vborg.vbsupport.ru/showthread.php?postid=406074#post406074)
Don't you mean to put it under this?
No, I checked, it's correct as I wrote.