Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
Prev Previous Post   Next Post Next
  #11  
Old 10-17-2011, 06:16 PM
imcool2121 imcool2121 is offline
 
Join Date: May 2010
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 View Post
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 View Post
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
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:14 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
  • Page Generation 0.05272 seconds
  • Memory Usage 2,781KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (4)bbcode_code
  • (8)bbcode_php
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (14)post_thanks_box
  • (14)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (14)post_thanks_postbit_info
  • (14)postbit
  • (14)postbit_onlinestatus
  • (14)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete