your hack in previous post is working now fine mate, it was cache problem i think.
all links in code tag are now clickable.
many many thanks to you...
Quote:
Originally Posted by nerbert
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);
}
}
|
--------------- Added [DATE]1318879141[/DATE] at [TIME]1318879141[/TIME] ---------------
Quote:
Originally Posted by kh99
Maybe it's due to cached posts? If so then old ones should appear as the cached version expires, or you could try rebuilding the post cache in the ACP.
|
yeah, you are absolutely right mate, it was cache problem

now everything is ok.
--------------- Added [DATE]1318879521[/DATE] at [TIME]1318879521[/TIME] ---------------
hey mate,
i am currently using vbulletin 4.1.7 and i didn't find any plugin for the following task -
the plugin must be able to show the users their referral link code in their user cp.
also, in usercp, they must be able to see their all referred friends.
can you provide any plugin for this or help with this issue ?
let me know. thanks