Hide Link

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Suggested Hosts

Hide Link

Postby apneweb » Fri May 27, 2011 6:36 pm

hi i want little help
i want to hide external link from guests
for example

if some one share link on forum. guest will not allowed to click
when they login on forum then they are allowed to click on link

please tell me what can i do.which permission i set on ACP
Last edited by tmbackoff on Sat May 28, 2011 5:51 am, edited 1 time in total.
Reason: moved from Support to MOD Requests
apneweb
Registered User
 
Posts: 32
Joined: Mon May 23, 2011 3:54 pm

Re: Hide Link

Postby apneweb » Sat May 28, 2011 8:41 am

help plz :roll:
apneweb
Registered User
 
Posts: 32
Joined: Mon May 23, 2011 3:54 pm

Re: Hide Link

Postby apneweb » Sat May 28, 2011 11:46 am

i want to like this

Image


this is also phpbb forum
link is here
http://allindiaforums.com/
apneweb
Registered User
 
Posts: 32
Joined: Mon May 23, 2011 3:54 pm

Re: Hide Link

Postby Oyabun1 » Sat May 28, 2011 1:57 pm

There's a few different ways of doing that, such as Guest Hide BB-Code MOD or Prime Links (see the comment in prime_links.php file for hiding links from guests).
User avatar
Oyabun1
Support Team Member
Support Team Member
 
Posts: 16205
Joined: Sun May 17, 2009 1:05 pm
Location: Australia
Name: Bill

Re: Hide Link

Postby Stoker 4.0 » Sat May 28, 2011 2:52 pm

I would go for Prime Links, but I used to use this code by MSSTI:

This topic is a reminder of a mod that is written by MSSTI and not released fully anywhere.


Open viewtopic.php
Find:
Code: Select all
        $user_cache[$poster_id]['sig'] = censor_text($user_cache[$poster_id]['sig']);

Add before:
Code: Select all
// MOD : MSSTI Hide links (V1.0.2) - Start
        if ($user->data['user_id'] == ANONYMOUS)
        {
            $user_cache[$poster_id]['sig'] = hide_link($user_cache[$poster_id]['sig'], $user_cache[$poster_id]['sig_bbcode_uid'], 'sig');
        }
// MOD : MSSTI Hide links (V1.0.2) - End

Find:
Code: Select all
   // Second parse bbcode here

Add before:
Code: Select all
// MOD : MSSTI Hide links (V1.0.2) - Start
   if ($user->data['user_id'] == ANONYMOUS)
   {
      $message = hide_link($message, $row['bbcode_uid']);
   }
// MOD : MSSTI Hide links (V1.0.2) - End


Open includes/function.php
Find:
Code: Select all
?>

Add before:
Code: Select all
// MOD : MSSTI Hide links (V1.0.2) - Start
function hide_link($text, $uid = '', $mode = 'post')
{
   if (!defined('IN_HIDE'))
   {
      define('IN_HIDE', true);

      define('IN_SIGNATURE',      false);   // Hide links on signatures ?            default false
      define('IN_LINE_URL',      true);   // Hide in-line links ?                  default true
      define('IN_BBCODE_URL',      true);   // Hide links into the bbcode [url][/url]   default true   
      define('IN_BBCODE_IMG',      false);   // Hide links into the bbcode [img][/img]   default false
      define('IN_BBCODE_CODE',   true);   // Hide links into the bbcode [code][/code]   default true
   }

   if ($mode == 'sig' && !IN_SIGNATURE)
   {
      return $text;
   }

   global $user, $phpbb_root_path, $phpEx;
   global $forum_id, $topic_id, $post_id;

   $redirect = array();
   if ($forum_id)
   {
      $redirect['f'] = $forum_id;
   }
   if ($topic_id)
   {
      $redirect['t'] = $topic_id;
   }
   if ($post_id)
   {
      $redirect['p'] = $post_id;
   }

   $hidelink_redirect = append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=login&redirect=" . urlencode(str_replace('&', '&', append_sid("{$phpbb_root_path}viewtopic.$phpEx", $redirect))));
   $hidelink_search   = array();
   $hidelink_replace  = '<span class="hidelink"><a href="' . $hidelink_redirect . '">'. $user->lang['LOGIN_EXPLAIN_VIEW'] . '</a></span>';

   if (IN_BBCODE_CODE)
   {
      if (IN_LINE_URL)
      {
         // we need to turn the entities back into their original form
         $entities   = array("[code:$uid]",   '&#46;', '&#58;', '&#058;');
         $characters = array("[code:$uid]\n", '.',     ':',     ':');
         $text = str_replace($entities, $characters, $text);
         $text = make_clickable($text, generate_board_url());
      }

      if (IN_BBCODE_URL)
      {
         $hidelink_search[] = "#\&\#91;url\&\#93;(.*?)\&\#91;\/url\&\#93;#is";
         $hidelink_search[] = "#\&\#91;url(=(.*?))\&\#91;\/url\&\#93;#si";
         $hidelink_search[] = "#\[url(=(.*))?\]([\]].*)\[/url\]#si";
      }

      if (IN_BBCODE_IMG)
      {
         $hidelink_search[] = "#\&\#91;img\&\#93;(.*?)\&\#91;\/img\&\#93;#is";
         $hidelink_search[] = "#\[img\]([\]].*)\[/img\]#si";
      }
   }

   // OK
   if (IN_LINE_URL)
   {
      $hidelink_search[] = '#<!-- ([lmwe]) --><a class=\"(postlink|postlink-local)\" href=\"(.*?)\">(.*?)</a><!-- ([lmwe]) -->#si';
   }

   // OK
   if (IN_BBCODE_URL)
   {
      $hidelink_search[] = "/\[url:$uid\](.*?)\[\/url:$uid\]/is";
      $hidelink_search[] = "/\[url\=(.*?):$uid\](.*?)\[\/url:$uid\]/is";
   }

   // OK
   if (IN_BBCODE_IMG)
   {
      $hidelink_search[] = "#\[img:$uid\](.*?)\[/img:$uid\]#s";
      $hidelink_search[] = "#\[img\=(.*?):$uid\](.*?)\[/img:$uid\]#s";
   }

   $text = preg_replace ($hidelink_search, $hidelink_replace, $text);
   
   return $text;
}
// MOD : MSSTI Hide links (V1.0.2) - End


Open language/en/common.php
Find:
Code: Select all
   'IMAGE'                  => 'Image',

Add after:
Code: Select all
// MOD : MSSTI Hide links (V1.0.1) - Start
   'LOGIN_EXPLAIN_VIEW'      => 'The board requires you to be registered and logged in to view links.',
// MOD : MSSTI Hide links (V1.0.1) - End


Open styles/prosilver/theme/colours.css
Add at the bottom:
Code: Select all
/* MOD : MSSTI Hide links (V1.0.2) - Start */
code .hidelink { line-height: 2em; }
.hidelink a { border: 1px solid #cccccc; border-collapse: collapse; padding: 1px 2px; color:#ff0000; background-color: #ffffff; font-weight: normal; text-decoration: none; font-size: 1em; line-height: 1.2em;}
/* MOD : MSSTI Hide links (V1.0.2) - End */
User avatar
Stoker 4.0
Registered User
 
Posts: 764
Joined: Sun Feb 13, 2011 1:33 pm
Name: Ulrik Christensen

Re: Hide Link

Postby apneweb » Sat May 28, 2011 4:48 pm

is this secure method ??
i want to recommend from support team

support team please tell me is this a secure method? or hacking :?
i m confused

anyways thanks for help dude
apneweb
Registered User
 
Posts: 32
Joined: Mon May 23, 2011 3:54 pm

Re: Hide Link

Postby Oyabun1 » Sat May 28, 2011 11:55 pm

The team here is unlikely to comment on scripts that have not been submitted to the MODs’ database – they just don’t have the time. The team here may sometimes provide a link to a particular MOD, but that shouldn't be seen a "recommendation" to use it.

If you are not confident using the edits Ulrick suggested then don’t use them. The validated MODs I linked you to have been checked in regards to security. As Ulrick suggested, Prime Links is good, and provides numerous functions in addition to being able to hide links.
User avatar
Oyabun1
Support Team Member
Support Team Member
 
Posts: 16205
Joined: Sun May 17, 2009 1:05 pm
Location: Australia
Name: Bill

Re: Hide Link

Postby apneweb » Sun May 29, 2011 8:06 am

hi stocker

your method is not working for me when i upload file and check fatal error show :cry:
i want your help
and what is prime link
is it same for hide links??? :?:
apneweb
Registered User
 
Posts: 32
Joined: Mon May 23, 2011 3:54 pm

Re: Hide Link

Postby Stoker 4.0 » Sun May 29, 2011 8:15 am

Prime links is here: viewtopic.php?t=875585
It make posted links open in a new window.
But it can also hide links for guests.

To do so you will have to open the included file prime_links.php
You will find this in that file:
Code: Select all
define('HIDE_LINKS_FROM_GUESTS',

Change it with this and guests cant see links:
Code: Select all
define('HIDE_LINKS_FROM_GUESTS', '<span style="font-weight:bold; color:red;">You have to be logged in to see links!</span>');   // Hide external links from guests? If this is a string, then the text of the link will be replaced with this string.
User avatar
Stoker 4.0
Registered User
 
Posts: 764
Joined: Sun Feb 13, 2011 1:33 pm
Name: Ulrik Christensen

Re: Hide Link

Postby apneweb » Sun May 29, 2011 8:32 am

hi i m totaly new member
i have no idea about php :cry:
i download file prime_links_1_2_8

what is next procedure? will i upload on my server
please tell me what can i do
apneweb
Registered User
 
Posts: 32
Joined: Mon May 23, 2011 3:54 pm

Re: Hide Link

Postby Stoker 4.0 » Sun May 29, 2011 9:47 am

Take a look at this post: viewtopic.php?f=69&t=724145
User avatar
Stoker 4.0
Registered User
 
Posts: 764
Joined: Sun Feb 13, 2011 1:33 pm
Name: Ulrik Christensen

Re: Hide Link

Postby apneweb » Sun May 29, 2011 10:30 am

Stoker 4.0 wrote:Take a look at this post: viewtopic.php?f=69&t=724145


hi stoker i will b very thank full to you if u give me one favor
i will send those 4 files in to your email please set them i m to much new in php and my english is also low
i wont understand please help me i will b thank full to you.hide guset link and link also opne in new windows


Remember
my forum style is subsilver2


Thanks in advance stoker
apneweb
Registered User
 
Posts: 32
Joined: Mon May 23, 2011 3:54 pm

Re: Hide Link

Postby apneweb » Sun May 29, 2011 3:27 pm

hi stoker my problem is resolved
thank you so much for your help
big thums up for you
apneweb
Registered User
 
Posts: 32
Joined: Mon May 23, 2011 3:54 pm

Re: Hide Link

Postby Stoker 4.0 » Sun May 29, 2011 6:17 pm

I am glad you got it working apneweb ;)
User avatar
Stoker 4.0
Registered User
 
Posts: 764
Joined: Sun Feb 13, 2011 1:33 pm
Name: Ulrik Christensen

Re: Hide Link

Postby apneweb » Mon May 30, 2011 7:37 am

Thanks alot 8-)
apneweb
Registered User
 
Posts: 32
Joined: Mon May 23, 2011 3:54 pm


Return to [3.0.x] MOD Requests

Who is online

Users browsing this forum: omgili [Bot], PageFetcher [Google] and 15 guests