vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   [Need Help]Auto clickable links with tab [CODE] ? (https://vborg.vbsupport.ru/showthread.php?t=253175)

imcool2121 10-17-2011 06:16 PM

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 (Post 2258289)
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 (Post 2258204)
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

nerbert 10-18-2011 01:08 AM

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".

nerbert 08-16-2014 12:58 AM

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.

CAG CheechDogg 08-16-2014 06:25 AM

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

MANY MANY THANKS!


All times are GMT. The time now is 08:02 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.01059 seconds
  • Memory Usage 1,745KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete