|
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 ?
|
|
|
|
Joined: May 2001
Posts: 550
Code Monkey
|
Code Monkey
Joined: May 2001
Posts: 550 |
No. 
|
|
|
|
Joined: Sep 2003
Posts: 803
Coder
|
Coder
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
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 
|
|
|
|
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
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
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): // 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? $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
Joined: May 2001
Posts: 550 |
>Is it as easy as changing the first two preg_replace's to the following?
Yes.
|
|
|
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.
|
|
Posts: 5,834
Joined: January 2000
|
|
Forums63
Topics37,575
Posts293,931
Members13,824
|
Most Online6,139 Sep 21st, 2024
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|