Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #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
  #12  
Old 10-18-2011, 01:08 AM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I thought the posts in the DB had all the bbcode parsed to HTML and the bbcode parser wouldn't be used by showthread.php.

Re: plugin project, I don't have the friends feature turned on in my forum and I'm the only one who visits the dev site so not familiar with how all the stuff to do with friends works. And I don't know what you mean by "referral link code".
Reply With Quote
  #13  
Old 08-16-2014, 12:58 AM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here's plugin code to do it.

At hook location url_to_bbcode

Code:
$skiptaglist = str_replace('|code|', '|', $skiptaglist);
At hook locatiom url_to_bbcode_callback

Code:
$taglist .= '|\[code|\[/code';
See functions starting at line 165 in includes/functions_newpost.php

A lot cleaner than editing in a hack.
Reply With Quote
  #14  
Old 08-16-2014, 06:25 AM
CAG CheechDogg's Avatar
CAG CheechDogg CAG CheechDogg is offline
 
Join Date: Feb 2012
Location: Riverside, California USA
Posts: 1,080
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great stuff here you guys...always great to see you guys put in work for us !

MANY MANY THANKS!
Reply With Quote
Reply


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 06:42 AM.


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.03850 seconds
  • Memory Usage 2,216KB
  • Queries Executed 11 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (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_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • 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
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete