Sign in to follow this  
Followers 0

Hiding links from guests.


Description

This is a very shor tutorial which will teach you on how to hide both links and hidden codes in posts from unregistered users (guests)
You will have to edit one file:

/admin/applications/forums/modules_public/forums/topics.php

First, make a backup file so that if anything goes wrong, you can replace it...

After doing that, find this line of code:

[code]$template = $this->registry->output->getTemplate('topic')->topicViewTemplate( $this->forum, $this->topic, $post_data, $displayData );[/code]

Above that line, add following code:

[code]if (!$this->memberData['member_id'])
{
foreach($post_data as $k => $postData)
{
foreach($postData as $key => $post)
{
$post_data[$k][$key]['post'] = preg_replace('#<pre class=\'prettyprint\'>(.*?)</pre>#', ' <font color=\'red\'><b>Please <a href=\'index.php?app=core&module=global&section=login\' style=\'text-decoration:none;\'>Login</a> or <a href=\'index.php?app=core&module=global&section=register\' style=\'text-decoration:none;\'>Signup</a> to see this Hidden Code</b></font> ', $post['post']);
}
}
}

if (!$this->memberData['member_id'])
{
foreach($post_data as $k => $postData)
{
foreach($postData as $key => $post)
{
$post_data[$k][$key]['post'] = preg_replace('#<a(.*?)rel=\'nofollow external\'(.*?)<(.*?)a>#', ' <font color=\'red\'><b>Please <a href=\'index.php?app=core&module=global&section=login\' style=\'text-decoration:none;\'>Login</a> or <a href=\'index.php?app=core&module=global&section=register\' style=\'text-decoration:none;\'>Signup</a> to see this Hidden Link</b></font> ', $post['post']);
}
}
}[/code]

Final result, all the guests will see this message instead of links:

[color="#FF0000"][b]Please[/color] [color="#0000FF"]Login [/color][color="#FF0000"]or[/color] [color="#0000FF"]Signup[/color][color="#FF0000"] to see this Hidden Link![/color][/b]

[color="#FF0000"][b]Please[/color] [color="#0000FF"]Login [/color][color="#FF0000"]or[/color] [color="#0000FF"]Signup[/color][color="#FF0000"] to see this Hidden Code![/color][/b]

Iron Head, PoDo, Rick and 1 other like this


0 Comments

There are no comments to display.