2012-10-30, 07:35 PM
Pages: 1 2
2012-10-30, 08:21 PM
try this! http://mods.mybb.com/view/hide-links-2
or edit inc/class_parser.php
find:
find:
or edit inc/class_parser.php
find:
if(!preg_match("#^[a-z0-9]+://#i", $url))
{
$url = "http://".$url;
}
add aboveglobal $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;
}
2012-10-30, 09:11 PM
I will. Thanks!
2013-01-31, 12:19 PM
How about SEO problems whithout links for Google (that is a guest)?
2013-02-05, 10:44 PM
We need something like this, for Mybb. This mods are good but without any settings.
2013-02-06, 04:44 AM
2013-02-06, 10:24 AM
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...
2013-03-12, 01:27 PM
(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:
add aboveif(!preg_match("#^[a-z0-9]+://#i", $url)) { $url = "http://".$url; }
global $mybb; if($mybb->user['uid'] != 0) {
find:
add below:$link = "<a href=\"$fullurl\" target=\"_blank\">$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; }
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('&', '&', $url);
$name = str_replace('&', '&', $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("#&\#([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
2013-03-17, 05:21 AM
looking for this one too for my forum..
2015-10-17, 10:05 PM
Hello, I do it like this:
Find:
Find:
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