vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Apply "rel=nofollow" attribute to all parsed URLs (https://vborg.vbsupport.ru/showthread.php?t=93780)

Greg-J 07-09-2008 04:50 AM

Quote:

Originally Posted by RaZor Edge (Post 1446398)
I'm using this code on 3.6.8 and it's running fine.

As I want this to work with every user exept my staff, I have removed the part with number of post.

Here's what I am using:

Code:

$this->tag_list['no_option']['url']['callback'] = 'handle_external';
$this->tag_list['no_option']['url']['external_callback'] = 'handle_bbcode_url_relnofollow';
$this->tag_list['option']['url']['callback'] = 'handle_external';
$this->tag_list['option']['url']['external_callback'] = 'handle_bbcode_url_relnofollow';
if (!function_exists('handle_bbcode_url_relnofollow'))
{
    function handle_bbcode_url_relnofollow($parser, $text, $link)
    {
        global $post;
        // Excempt Mods+ and Users with mor then 50 Posts
        $parsedurl = $parser->handle_bbcode_url($text, $link);
        if (is_member_of(5, 6, 36))
        {
            return $parsedurl;
        }
        else
        {
            return str_replace('href="', 'rel="nofollow" href="', $parsedurl);
        }
    }
}


Your code will not work as you are not passing is_member_of() the users current groupid. It should be:

PHP Code:

$this->tag_list['no_option']['url']['callback'] = 'handle_external';
$this->tag_list['no_option']['url']['external_callback'] = 'handle_bbcode_url_relnofollow';
$this->tag_list['option']['url']['callback'] = 'handle_external';
$this->tag_list['option']['url']['external_callback'] = 'handle_bbcode_url_relnofollow';
if (!
function_exists('handle_bbcode_url_relnofollow'))
{
    function 
handle_bbcode_url_relnofollow($parser$text$link)
    {
        global 
$post;
        
// Excempt Mods+ and Users with mor then 50 Posts
        
$parsedurl $parser->handle_bbcode_url($text$link);
        if (
is_member_of($post5636))
        {
            return 
$parsedurl;
        }
        else
        {
            return 
str_replace('href="''rel="nofollow" href="'$parsedurl); 
        }
    }



Greg-J 07-09-2008 07:31 AM

Quote:

Originally Posted by oldengine (Post 1556118)
A whitelist ability for your own forum's domain name would be an excellent add-on to this mod.

That's an easy fix. I tried to write it so it would work universaly, but I can't seem to get $vbulletin->options from within the plugin...

Anyway, use this but replace 'DOMAIN_NAME' with your domain. For instance, if vbulletin.org used this mod they would replace 'DOMAIN_NAME' with 'vbulletin'

PHP Code:

$this->tag_list['no_option']['url']['callback'] = 'handle_external';
$this->tag_list['no_option']['url']['external_callback'] = 'handle_bbcode_url_relnofollow';
$this->tag_list['option']['url']['callback'] = 'handle_external';
$this->tag_list['option']['url']['external_callback'] = 'handle_bbcode_url_relnofollow';
if (!
function_exists('handle_bbcode_url_relnofollow'))
{
    function 
handle_bbcode_url_relnofollow($parser$text$link)
    {
        global 
$post;
        
$parsedurl $parser->handle_bbcode_url($text$link);
        if (
is_member_of($post56) || strpos($parsedurl'DOMAIN_NAME') !== false)
        {
            return 
$parsedurl
        }
        else
        {
            return 
str_replace('href="''rel="nofollow" href="'$parsedurl); 
        }
    }



JPnyc 10-23-2008 04:26 PM

Anyone know why this works for sig links in 3.5 but not in 3.7.x?

JPnyc 10-24-2008 06:53 PM

nevermind, signature cache needed to be released.


All times are GMT. The time now is 07:19 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.01219 seconds
  • Memory Usage 1,749KB
  • 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
  • (1)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
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (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