Previous Thread
Next Thread
Print Thread
Rate Thread
#283163 01/19/2005 3:18 PM
Joined: Jan 2003
Posts: 263
Member
Member
Joined: Jan 2003
Posts: 263
I would really love a mod that would change certain words on my forum into predefined links. It would actually work just like the badwords filter, only now each 'bad word' would have it's own substitute link.

This way I could have auto-links to previous discussed topics or, the most important: link to my affilates!

So if the company name of my affiliate program would be mentioned, it would automatically be substututed by my affiliate URL...

Crazy idea ?

Sponsored Links
Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
No.

Joined: Sep 2003
Posts: 803
Coder
Coder
Offline
Joined: Sep 2003
Posts: 803
That would be sweet.

could also work like the bad word filter is the sence that you would put the linkable word like this....

halo2=www.bungie.net

Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
well....

Let's try this.

Enable censoring, and enter your link urls there in the form:

targetword=http://www.this.is/thelink.htm


Then
in ubb.inc.php

search for:

$replacewords[] = $replace;

replace with:

if (stristr($replace,"http")){
$replacewords[]= "".$replace."";
}else{
$replacewords[] = $replace;
}


in addpost.php

search for:
if ($config['docensor']) {

replace with:
if ($config['docensor'] && $preview != 1 ) {

Joined: Oct 2003
Posts: 2,305
Old Hand
Old Hand
Joined: Oct 2003
Posts: 2,305
just inject yourself with the hijack virus.. it does it

Sponsored Links
Joined: Jan 2003
Posts: 263
Member
Member
Joined: Jan 2003
Posts: 263
Looking forward to test this out!
Only what code to change in 6.4 ? This one seems to be for 6.5

Another question: many words/company names I would like to replace by a link, consist of two words. Could this mod also handle that? For example: "coca cola"

Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
>many words/company names I would like to replace by a link, consist of two words. >Could this mod also handle that?

This particular mod as it is, no.

This mod will only work for 6.5 since 6.4 handles the censoring differently.

Joined: Jan 2003
Posts: 263
Member
Member
Joined: Jan 2003
Posts: 263
Ok, in that case I'll just have to wait for 6.5.1
Thanks so far Anno!

Joined: Sep 2004
Posts: 15
Newbie
Newbie
Offline
Joined: Sep 2004
Posts: 15
I have a similar question. A site that I visit uses an old version of WWWThreads, and when you paste or type a link without using the URL tag, it will automatically convert the link, but it will show up as "The Link" instead of the entire URL. I'd like to do that with 6.5, but the solution is not obvious.

This is the section of code I'm looking at (from ubbt.inc.php):

Code
    // Convert www -> html<br />        $Body = " " . $Body;<br />        $Body = preg_replace("#([\n\r ])([a-z]+?)://([^, \n\r]+)#i", "\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>", $Body);<br />        $Body = preg_replace("#([\n\r ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^, \n\r]*)?)#i", "\\1<a href=\"http://www.\\2.\\3\\4\" target=\"_blank\">www.\\2.\\3\\4</a>", $Body);<br />        $Body = preg_replace("#([\n\r ])([a-z0-9\-_.]+?)@([^, \n\r]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $Body);<br />        $Body = substr($Body, 1);


Is it as easy as changing the first two preg_replace's to the following?

Code
        $Body = preg_replace("#([\n\r ])([a-z]+?)://([^, \n\r]+)#i", "\\1<a href=\"\\2://\\3\" target=\"_blank\">The Link</a> ", $Body);<br />        $Body = preg_replace("#([\n\r ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^, \n\r]*)?)#i", "\\1<a href=\"http://www.\\2.\\3\\4\" target=\"_blank\">The Link</a> ", $Body);


Any help would be appreciated.

Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
>Is it as easy as changing the first two preg_replace's to the following?

Yes.

Sponsored Links

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Zarzal
Zarzal
Berlin, Germany
Posts: 808
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240506)