MyBB Community Forums

Full Version: Hide Links from Guests for mybb 1.6.8?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Is this plugin available for mybb 1.6.8?
I installed it but it does not run with my version of mybb (1.6.8).

Thanks!
try this! http://mods.mybb.com/view/hide-links-2

or edit inc/class_parser.php

find:
if(!preg_match("#^[a-z0-9]+://#i", $url))
                {
                    $url = "http://".$url;
                } 
add above
global $mybb;
            if($mybb->user['uid'] != 0)
            { 

find:
$link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>";
                return $link; 
add below:
}
            else
            {
                $link = "<a href=\"member.php?action=register\" target=\"_blank\">You can't view the links! Click here to register</a>";
                return $link;
            } 
I will. Thanks!
How about SEO problems whithout links for Google (that is a guest)?
We need something like this, for Mybb. This mods are good but without any settings.
The php mod sugested by tamnguyen949 work very good. I will consider to install a plugin, only for some options like "hide only external links". It's all about SEO...
(2012-10-30, 08:21 PM)tamnguyen949 Wrote: [ -> ]try this! http://mods.mybb.com/view/hide-links-2

or edit inc/class_parser.php

find:
if(!preg_match("#^[a-z0-9]+://#i", $url))
                {
                    $url = "http://".$url;
                } 
add above
global $mybb;
            if($mybb->user['uid'] != 0)
            { 

find:
$link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>";
                return $link; 
add below:
}
            else
            {
                $link = "<a href=\"member.php?action=register\" target=\"_blank\">You can't view the links! Click here to register</a>";
                return $link;
            } 


Can you explain in detail what changes we need to do in

inc/class_parser.php


I have done this change is this valid code

/**
* Parses URL MyCode.
*
* @param string The URL to link to.
* @param string The name of the link.
* @return string The built-up link.
*/
function mycode_parse_url($url, $name="")
{
global $mybb;
if($mybb->user['uid'] != 0)
{

if(!preg_match("#^[a-z0-9]+://#i", $url))
{
$url = "http://".$url;
}
$fullurl = $url;


$url = str_replace('&amp;', '&', $url);
$name = str_replace('&amp;', '&', $name);

if(!$name)
{
$name = $url;
}

$name = str_replace("\'", "'", $name);
$url = str_replace("\'", "'", $url);
$fullurl = str_replace("\'", "'", $fullurl);

if($name == $url && (!isset($this->options['shorten_urls']) || $this->options['shorten_urls'] != 0))
{
if(my_strlen($url) > 55)
{
$name = my_substr($url, 0, 40)."...".my_substr($url, -10);
}
}

$nofollow = '';
if(isset($this->options['nofollow_on']))
{
$nofollow = " rel=\"nofollow\"";
}

// Fix some entities in URLs
$entities = array('$' => '%24', '$' => '%24', '^' => '%5E', '`' => '%60', '[' => '%5B', ']' => '%5D', '{' => '%7B', '}' => '%7D', '"' => '%22', '<' => '%3C', '>' => '%3E', ' ' => '%20');
$fullurl = str_replace(array_keys($entities), array_values($entities), $fullurl);

$name = preg_replace("#&amp;\#([0-9]+);#si", "&#$1;", $name); // Fix & but allow unicode
$link = "<a href=\"$fullurl\" target=\"_blank\"{$nofollow}>$name</a>";
return $link;
}
else
{
$link = "<a href=\"member.php?action=register\" target=\"_blank\">You can't view the links! Click here to register</a>";
return $link;
}

}

for me only in reply portion this text appears in RED color

You can't view the links! Click here to register

but the image is still shown
looking for this one too for my forum..
Hello, I do it like this:

Find:
			if(!preg_match("#^[a-z0-9]+://#i", $url))
			{
				$url = "http://".$url;
			}
Do like this
	   global $mybb;
           if($mybb->user['uid'] != 0)
           { 
			if(!preg_match("#^[a-z0-9]+://#i", $url))
			{
				$url = "http://".$url;
			}
		}


Find:
	$link = "<a href=\"$url\" target=\"_blank\"{$nofollow}>$name</a>";
Do like this:
           if($mybb->user['uid'] != 0)
		{
		$link = "<a href=\"$url\" target=\"_blank\"{$nofollow}>$name</a>";
		}
		else
		{
 		$link = "<a href=\"member.php?action=register\" target=\"_blank\">You can't view the links! Click here to register</a>";
		}

Pages: 1 2