![]() |
Replace Text
This is more of a getting you started piece of code than a copy and paste your board is hacked kind of release. If you don't know how to code in PHP, this hack is NOT for you.
What this "hack" does is it allows you to replace a word in a post with something else. It doesn't replace the word in titles or anywhere else like replacements do. Just in a post. What I use it for: I replace the word Netflix in every post with a link to my Netflix affilliate. What you might use it for: affilliate links, swear word replacements with style, pranks, whatever :D You will need to modify the function that I have included to set up your own replacement words. You might want to replace more than one thing. It's up to you. Have fun with this and share what you have done. Demo: http://www.eaforums.com/forums/showt...threadid=22557 I will help as much as I can in customizing this for you within reason. |
Useful for updating smilie names, I'll check it out sometime. Nice work! :)
|
I don't mean to sound negative, but can't you do the same thing with tags in vbcode without hacking? ;)
|
The idea is you just type Netflix and it happens to turn into an affiliate link.
|
I understand that. But a tag would be more versatile instead of having to hack the php file every time you wanted to change it. But to each his own, I guess.
|
How is this different from the Replacement Variable system? I use it to replace the phrase "closednow" with an image of a padlock, sort of a funny tradition on my forums. Works for me.
|
I think this is more of a filter wich is biult in vB but doesn't work well with other languages... at least it didn't work for me
this could be a better way to make it censer certain words .. |
What this hack does is it replaces the word with a link or whatever you want retrospectively as well (I think). Also, it's better than replacement, as replacement affects post titles, whereas this doesn't (from what I can understand).
|
Erwin is correct. Replacements changed the word in thread titles, as well, which then effectively rendered the thread unreadable because it became a link to Netflix.
I didn't use vbbcode because I don't want to have to edit each post and I don't want to have to rely on the membership to put it in. I use this in conjunction with a hack Logician wrote for me eons ago that changes any link somebody posts to Amazon to a link that uses my affilliate ID. That hack helped quite a bit; so I am trying to expand slowly into other relevant affiliates. Amy |
wow i was just thinking of doing something like this. Im ganna build a page (might use the glossery hack) and have said word link to the glossery when its typed. this saves me some time :)
[high]* Brad licks install[/high] |
If you lick the install button, nobody else is going to want to touch it to click it. ;)
Amy |
Theres a reason we have paper towels ;).
|
This is a very nice idea.. /me likes
- miSt |
weird
if someone types in Amazon.com it posts it.. but if someone types amazon all lowercase.. it doesn't |
And to create more words we have to create more functions with:
($text1) ($text2) ($text3) etc. right? I'm pretty sure I'm right; just confirming ;). Very cool btw! |
yeah but if the poster links to a certain page..
like amazon.com/apage.html it screws with the hyperlink |
Fantastic Idea Amy :)
|
Quote:
You would add code something along the lines of: Code:
$affiliate_code2="Some other replacement string"; |
Quote:
Amy |
Quote:
That is now fixed. See the new text file. To "upgrade" you will need to change calls of str_replace to stri_replace and add the new function stri_replace at the bottom of functions.php as outlined in the updated text file. Amy |
Have you fixed it so that it doesn't mess up with someone types in amazon.com/apage.html so it doesn't screw with the URL? If it does, I will install.
|
Not yet, Derek. However, if you only want it for Amazon, Logician wrote a nice Amazon-specific version for me a year or so ago that is made for links.
Amy |
where is that at then?
|
<a href="https://vborg.vbsupport.ru/showthread.php?s=&threadid=39071&highlight=Amazon" target="_blank">https://vborg.vbsupport.ru/showt...ghlight=Amazon</a>
|
is there a way to use this for an ebay afilliate program?
Reason I ask is cause the urls need to be altered with the actual code of an = or ? ie. Code:
http://www.qksrv.net/click-1168523-5463217?loc=http%3A//cgi.ebay.com/ebaymotors/ws/eBayISAPI.dll%3FViewItem%26item%3D2413125104 also, if someone posts a full url to an item, that is not just a word, i guess it can't do this yet from what i read? Thanks, Derek |
This hack would be a lot more useful if it was an expansion to Logician's Amazon code.
|
Well, then expand it if you need it :D
Amy |
got this working for 2.3?
|
Yes.
|
Nice idea amy;):)
Satan |
When the correct phrase is typed in html link is the output, but its text and not linkable. Anyway to make it just show FOO linked?
Ive seen this output on your site as well Amy for the Netflix code. Is this way its supposed to be? <a href="http://www.foo.com/index.html?fooAffilID=716" TARGET="_top">FOO</a> thanks again. |
Not sure what you are asking Limey
|
Ok go to this link:
http://www.eaforums.com/forums/showt...hlight=netflix Goto Joubert's post. The output from the hack is not linkable. I'm seeing the same output of html on the site. I was wondering if there was a way to make the output a real link and not just text. Hope I'm not confusing ya! :D |
is this still working?
|
Limey, It's not working on my site right this second because I have a clean functions.php installed. My functions.php was corrupted a few days ago and I haven't rehacked it.
Amy |
Xone, yes it still works.
Amy |
I have the hacked functions and its doing the same thing on my site as it is on your site. Very weird.
|
<a href="http://www.pokeritis.com/forums/showthread.php?threadid=11612" target="_blank">my example</a>
|
Great! If it would for titles - it would be ven better!
|
I can't seem to get this to work. My problem is that I can't find the proper place to put stri_replace. The doc says to find
[code[]?> [/code[] but I can't seem to find that in functions.php. What am I missing? |
All times are GMT. The time now is 04:50 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|