vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Remove Extra Quotes From PMs (https://vborg.vbsupport.ru/showthread.php?t=41074)

Raz 07-14-2002 10:00 PM

Remove Extra Quotes From PMs
 
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:
Quote:

The first quote
Quote:

Quote:

The third quote (and so on)...
The second quote

becomes
Quote:

The first quote
OK open up 'private.php' in your favourite editor then goto line 542, which should have:
PHP Code:

    eval("\$message[message] = \"".gettemplate("priv_reply",1,0)."\";");
  } else {
    
$message = array();
  } 

and just above that place this
PHP Code:

    $message[message] = trim(preg_replace("~\[[b][/b]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...
Code:

$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

Quote:

Originally posted by FireFly
Hmm, shouldn't the code be...
Code:

$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 [disable][disable][/disable][/disable] tags.

Quote:

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

Quote:

Originally posted by Boofo
Can't you just attach it as a text file attachment? :) Or just use the [disable][disable][/disable][/disable] 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.

Quote:

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

Quote:

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

Quote:

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. :)

Quote:

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 [code]tag[/code]. The problem with slashes seems to be when using the [php]tag[/php]. :)

Admin 07-16-2002 11:37 AM

Quote:

Originally posted by Raz
Chen used the [code]tag[/code]. The problem with slashes seems to be when using the [php]tag[/php]. :)
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. :)

Quote:

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

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...

PHP Code:

$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

[disable]This is cool - I totally forgot about the "disable" tag:D[/disable]

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

Quote:

Yesterday at 04:51 PM gmarik said this in Post #32
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
PHP Code:

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

just under this
PHP Code:

      $subject="Re: $message[title]"


Boofo 06-08-2003 11:41 AM

Don't you mean to put it under this?

Quote:

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

julius 06-08-2003 12:45 PM

Quote:

Today at 02:41 PM Boofo said this in Post #36
Don't you mean to put it under this?
No, I checked, it's correct as I wrote.


All times are GMT. The time now is 04:43 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01272 seconds
  • Memory Usage 1,797KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (5)bbcode_php_printable
  • (16)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (37)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete