View Full Version : Word Replacement
applehat
08-05-2005, 10:00 PM
This is just a simple plug-in that will let you replace words in posts. This could be used for "AdWords" or Replacing curse words insted of just censoring.
Just thought I would share :-P
*cough* https://vborg.vbsupport.ru/ (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=93758) *cough*
I am a dumb novice, so this has no admin panel options or anything of that sort. If anyone ever wants to take this and make it all fancy, go ahead and just post.
Note: This should work on any 3.5 version that has the hook postbit_display_complete
This is the code...See how google is replaced with a link to google...make sence?
$word = array(
'google',
'yahoo'
);
$link = array(
'<a href="http://google.com">google</a>',
'<a href="http://yahoo.com">yahoo</a>'
);
$this->post['message'] = str_replace($word, $link, $this->post['message']);
ThePimp
08-06-2005, 09:24 PM
Nice one. Been looking for something like this... It would be nice to have this added to the admincp, with a CP module/plugin, where you can add a word + it's replacement value, possibly in the Forum Manager, and each forum can have different censors. Just a suggestion.
chanzero
08-07-2005, 01:12 AM
thanks! this fun. i used my to replace curse words with mytzlplk lol
BamaStangGuy
08-07-2005, 02:00 AM
umm is it just me or does this work exactly like the Replacement Variable Manager already in vBulletin?
umm is it just me or does this work exactly like the Replacement Variable Manager already in vBulletin?Except less powerful? Yea, it does. Very much so.
If I understood both systems correctly, the replacement variable manager affects everything in the post AND everything in templates. So if you replace "<td>" with "NO HTML", then all your templates with "<td>" in it would be broken, whereas this hack only affects data in a post.
I could be wrong, but that's my impression.
Logikos
08-07-2005, 09:36 AM
This does almost the same thing as my hack ..https://vborg.vbsupport.ru/showthread.php?s=&threadid=71191
Boofo
08-07-2005, 09:48 AM
This does almost the same thing as my hack ..https://vborg.vbsupport.ru/showthread.php?s=&threadid=71191
R U going to update yours for 3.5? ;)
Rhoads
08-07-2005, 10:00 AM
Nice hack, thnx ;)
Logikos
08-07-2005, 10:23 AM
R U going to update yours for 3.5? ;)
Of course I am. I'm going for that Master Coder tile. :p
akanevsky
08-07-2005, 12:48 PM
I was actually thinking of doing it myself, but since Live Wire is going to port the 3.0 version, I won't.
applehat
08-07-2005, 07:03 PM
I actualy used your had on vb3.0.7! I just needed something untille you updated yours. This was simple yo write and on our site we sell replacement words as advertisement...so I needed something quick. Once yours is releaced ill start using it again.
Thats why I have not worried about any admin cp stuff. Im to lazy to write all that since I knew you would port it :-P
Logikos
08-07-2005, 07:21 PM
I actualy used your had on vb3.0.7! I just needed something untille you updated yours. This was simple yo write and on our site we sell replacement words as advertisement...so I needed something quick. Once yours is releaced ill start using it again.
Thats why I have not worried about any admin cp stuff. Im to lazy to write all that since I knew you would port it :-P
I'm sorry to keep you waiting :p. have you deleted the database fields that my original hack creates? Cause if you didn't then when you upgrade my ported version, all your original data will still be available. :)
applehat
08-07-2005, 08:10 PM
actualy we went back to are heavy modded phpbb1.3 :-P
Its realy a long story...but yeah we have all the info.
The main features we are worried about right now is journals...that need to be ported eventualy XD..../me whonders who wrote that...*goes and looks*
Logikos
08-07-2005, 08:12 PM
actualy we went back to are heavy modded phpbb1.3 :-P
* Logikos is ashamed
applehat
08-08-2005, 01:51 AM
lol, we are gonna fully hack out our vb3.5 to what we need THEN...we will convert back.
Oh man, that phpbb is crappy *rolls eyes*
Audionuts
08-24-2005, 10:17 PM
is there any way to make this work in the thread title also?
so if a user posted the word in the title it would also be replaced?
thanks in advanced, and great hack!
is there any way to make this work in the thread title also?
so if a user posted the word in the title it would also be replaced?
thanks in advanced, and great hack!Is there any way? Yea, with replacement variables.
Audionuts
08-25-2005, 07:54 PM
and how do i go about doing that if you dont mind sharing?
and how do i go about doing that if you dont mind sharing?Basicly all this hack is is a weakend verision of replacement variables. I don't even see why this thread still exists.
You can set replacement variables in Admin CP -> Styles & Templates -> Replacement Variables Manager
Also, in the example, a link to google would be broken.
The user posts Google (http://google.com).
Instead of getting
<a href="http://google.com" target="_blank">Google</a>
They'd get
<a href="http://<a href="http://google.com">google</a>.com" target="_blank">Google</a>
The second google wouldn't even be replaced, beause this isn't even case sensitive.
Audionuts
08-26-2005, 02:56 AM
thank you TCM
amykhar
08-26-2005, 03:17 AM
Basicly all this hack is is a weakend verision of replacement variables. I don't even see why this thread still exists.
You can set replacement variables in Admin CP -> Styles & Templates -> Replacement Variables Manager
A hack like this is necessary BECAUSE it is weaker. If you change a word in the title of a thread to a link, then the replacement would mess up the link to the thread.
It would be ideal if the replacement system had an option. Replace everywhere or just replace in posts.
akanevsky
08-27-2005, 12:04 PM
You might need a simple regular expression here..
pyro.699
10-07-2005, 09:31 PM
nvm.
G-man
10-08-2005, 04:19 PM
This works great but is there a workaround for the fact some people use caps in brand names and others do not? I tried to put in the same brand name twice once with and once without a cap not thinking it would try to apply the link to both. How can we make this where it does not matter if the word has caps in it or not?
zagman76
11-20-2005, 06:06 AM
-bump-
...any updates? :)
GamerJunk.net
11-21-2005, 06:35 AM
This would be good for ads definatley...if I could find a good ad company that sells items like IGN does with their things
Luggruff
02-08-2006, 05:12 AM
don't have the postbit_display_complete template.. is there some other way? >_<
kobescoresagain
07-14-2006, 12:50 AM
so does this break links?
asasi
07-14-2006, 10:00 AM
great job!!
just a question. in windows XP 2 characters in my board language changed.
i can replace characters with this hack in db?:banana:
Snake
07-14-2006, 11:06 AM
Thanks, just installed it! :)
kobescoresagain
07-15-2006, 12:49 AM
DarkBlade can you fix this code... so it works correctly... I did some testing, and it breaks all links with one of those words on it.
aLReeMi
07-15-2006, 12:41 PM
greeeeeeeeeeeeeeeat
i was searching for something like that....
thanks alot...
nasko
07-17-2006, 07:52 PM
Where should i put this code on v.3.5.4?
BloodRavens
07-30-2008, 06:52 AM
Hello. Is this code work on 3.7x?
Anyoldname
02-15-2009, 10:47 PM
Anyone know if this will work on 3.8x?
mdawg
05-02-2009, 06:53 PM
Same question, will this work on 3.8.2 ?
Lynne
05-03-2009, 03:16 AM
It's just php string replacement, so yes it will work in 3.8.2.
MrRem
04-15-2010, 01:29 PM
And 3.8.5 ?
oedipean
02-10-2011, 05:25 AM
Is there something like it for VB 4 ?
prophetmuhammad
11-21-2011, 01:05 PM
need something like this for vb4 thanks
Sadie Frost
01-09-2012, 04:59 AM
Works on 3.8.6 :D
Saudi Zoom
06-25-2012, 08:19 AM
I used it to replace certain words with Google adsense codes that I'm planning to include in my articles in certain places! Worked perfect! Thx!
vikash.sharma
07-26-2012, 09:40 AM
Thanks applehat ..
RyanFabbro
12-01-2012, 12:09 PM
i know its a big bump but i wanted to point out to people, if you use spaces in your replacement words it shouldnt break the links
example
$word = array(
' google ',
'yahoo'
);
$link = array(
' <a href="http://google.com">google</a> ',
'<a href="http://yahoo.com">yahoo</a>'
);
$this->post['message'] = str_replace($word, $link, $this->post['message']);
notice in this example google links should be fine, but the yahoo ones probally will still break since they have no spaces
but be sure to include spaces in your replacement also, or it will end up like
let check outGOOGLEits cool
im not sure if you would use for the space or just use a normal space, i havent tested
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.