I couldn't get vB's function to work in a plugin so I used my own url detector. It may not be as robust as vB's but it's never failed yet.
I think I got this working
Product: vBulletin
Hook Location: showthread_complete
Execution order: 5 (or whatever)
PHP Code:
if($vbulletin->userinfo['userid'] == 1)
{
ini_set('display_errors', '1');
$nc = preg_match_all('#<pre.*</pre>#U', $postbits, $matches_code);
foreach($matches_code[0] AS $match_code)
{
$match = null;
$matches = null;
$url_regex = '#https?://(\w*:\w*@)?[-\w.]+(:\d+)?(/([\w/_.]*(\?\S+)?)?)?[^<\.,:;"\'\s]+#';
$n = preg_match_all($url_regex, $match_code, $matches);
foreach($matches[0] AS $match)
{
$html_url = '<a href="' . $match . '" target="_blank">' . $match . '</a>';
$match_string = str_replace($match, $html_url, $match_code);
}
$postbits = str_replace($match_code, $match_string, $postbits);
}
}
Change the first line to put in your own userid where you see 1. That way it will only work for you. Later if it works you can eliminate that whole conditional.
When you paste this in be sure $url_regex = ..... is all one continuous line with no spaces.
Get rid of the old hack and test the hell out of this and see what happens.
--------------- Added [DATE]1318878877[/DATE] at [TIME]1318878877[/TIME] ---------------
Already found a problem. Revised code:
PHP Code:
if($vbulletin->userinfo['userid'] == 1)
{
ini_set('display_errors', '1');
$nc = preg_match_all('#<pre[\s\S]*</pre>#U', $postbits, $matches_code);
foreach($matches_code[0] AS $match_code)
{
$match = null;
$matches = null;
$url_regex = '#https?://(\w*:\w*@)?[-\w.]+(:\d+)?(/([\w/_.]*(\?\S+)?)?)?[^<\.,:;"\'\s]+#';
$n = preg_match_all($url_regex, $match_code, $matches);
foreach($matches[0] AS $match)
{
$html_url = '<a href="' . $match . '" target="_blank">' . $match . '</a>';
$match_string = str_replace($match, $html_url, $match_code);
}
$postbits = str_replace($match_code, $match_string, $postbits);
}
}