View Full Version : Mod that will replace certain word with another
Sean S
02-15-2011, 02:33 PM
Hi there,
I remember seeing a mod for vB4 here before which allowed certain words to be replaced by another. For example, in the setting you could have
red;orange
and the mod would replace posts containing the word red with orange. I can't seem to find it here now, anyone can help or know the name of the mod? :(
thank you.
Lynne
02-15-2011, 03:32 PM
You can just use Replacement Variables. Or, write a plugin with a $find array and $replace array and just do a str_replace where you want it.
Sean S
02-25-2011, 04:58 PM
thanks Lynne, that seems to be the easier option :)
prophetmuhammad
11-21-2011, 01:13 PM
is this how you do this?
$find = array(
'word'
);
$replace = array(
'word1'
);
$this->post['message'] = str_replace($find, $replace, $this->post['message']);
Lynne
11-21-2011, 05:55 PM
Yes, that is how you should do it.
prophetmuhammad
11-22-2011, 03:10 AM
tried it, doesn't work. i run vb 4.1.7
Which hook location did you use?
prophetmuhammad
11-22-2011, 03:40 AM
Which hook location did you use?
i'm not really sure which one to use! can't find anything that refers to the post :\
right now it's set to the default that came with the script... postbit_display_complete
Lynne
11-22-2011, 06:31 PM
That code worked just fine for me using the postbit_display_complete hook location on my 4.1.8 test site.
prophetmuhammad
11-22-2011, 06:52 PM
ok i figured it out. turns out the script doesn't work for phrases i guess
I don't see why it wouldn't work for phrase, but you do have to remember that it's html so the pattern to search for might not be obvious. (But you can probably view the html source of the page and see what the phrase looks like).
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.