Hi,
is there a plugin or a function to hide posted links from guests?
i want that only registered users can see links. the same like attachement function. guests can't download attachements.
any ideas?
thanks alot!
1) Open the file inc/functions_post.php and search for:
function doshorturl($url, $name="")
{
$fullurl = $url;
// attempt to make a bit of sense out of their url if they dont type it properly
if(strpos($url, "www.") === 0)
{
$fullurl = "http://".$fullurl;
}
if(strpos($url, "ftp.") === 0)
{
$fullurl = "ftp://".$fullurl;
}
if(strpos($fullurl, "://") === false)
{
$fullurl = "http://".$fullurl;
}
if(!$name)
{
$name = $url;
}
$name = stripslashes($name);
$url = stripslashes($url);
$fullurl = stripslashes($fullurl);
if($name == $url)
{
if(strlen($url) > 55)
{
$name = substr($url, 0, 40)."...".substr($url, -10);
}
}
$link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>";
return $link;
}
Replace with:
function doshorturl($url, $name="")
{
global $mybb;
$fullurl = $url;
// attempt to make a bit of sense out of their url if they dont type it properly
if(strpos($url, "www.") === 0)
{
$fullurl = "http://".$fullurl;
}
if(strpos($url, "ftp.") === 0)
{
$fullurl = "ftp://".$fullurl;
}
if(strpos($fullurl, "://") === false)
{
$fullurl = "http://".$fullurl;
}
if(!$name)
{
$name = $url;
}
$name = stripslashes($name);
$url = stripslashes($url);
$fullurl = stripslashes($fullurl);
if($name == $url)
{
if(strlen($url) > 55)
{
$name = substr($url, 0, 40)."...".substr($url, -10);
}
}
if($mybb->user['uid'] != "0") {
$link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>";
} else {
$link = "<span style=\"color: red;\">You have to be registered to see this link</span>";
}
return $link;
}
2) Admin-CP -> Users and Groups -> Manage Groups -> Unregistered/Not logged in -> Edit -> Can doenload attachments -> No.