Invision Power Board: Hide Links

Product:
Invision Power Board

IPB version:
v2.3.x

Description:
Hide thread posted links from selected guest, eg. Guests, Banned users etc.

Let’s start here!

1. Open file: sources/lib/func_topic_linear.php
Find:


//-----------------------------------------

// Print post row

//-----------------------------------------

and add:

if($this->ipsclass->vars['bl_hide_links_on']){
  if (in_array($this->ipsclass->member['mgroup'],
        explode(',', $this->ipsclass->vars['bl_hide_links_group']))){
        $gelen=$row['post'];
        $post_array = preg_split('/(<a.*?<*a>)/', $gelen, 65535, PREG_SPLIT_DELIM_CAPTURE |  PREG_SPLIT_NO_EMPTY);
        for ($i=0; $i<=count($post_array); $i++){
            if(strstr($post_array&#91;$i&#93;, '<a'))
            $gelen = str_replace($post_array&#91;$i&#93;,
            $this->ipsclass->vars['bl_hide_links_replace'], $gelen);
            }

        // replace code [CODE]
        $post_array = preg_split('/(<!--ec1-->.*?<!--c2-->)/', $gelen, 65535, PREG_SPLIT_DELIM_CAPTURE |  PREG_SPLIT_NO_EMPTY);
        for ($i=0; $i<=count($post_array); $i++){
            if(strstr($post_array&#91;$i&#93;,'<!--ec1-->'))
            $gelen=str_replace($post_array[$i],
            $this->ipsclass->vars['bl_hide_links_replace_code'], $gelen);
            }
        $row['post'] = $gelen;
    }
}

2. Open file: sources/lib/func_topic_threaded.php
Find:


//-----------------------------------------

// Print post row

//-----------------------------------------

and add:

if($this->ipsclass->vars['bl_hide_links_on']){
  if (in_array($this->ipsclass->member['mgroup'],
        explode(',', $this->ipsclass->vars['bl_hide_links_group']))){
        $gelen=$row['post'];
        $post_array = preg_split('/(<a.*?<*a>)/', $gelen, 65535, PREG_SPLIT_DELIM_CAPTURE |  PREG_SPLIT_NO_EMPTY);
        for ($i=0; $i<=count($post_array); $i++){
            if(strstr($post_array&#91;$i&#93;, '<a'))
            $gelen = str_replace($post_array&#91;$i&#93;,
            $this->ipsclass->vars['bl_hide_links_replace'], $gelen);
            }

        // replace code [CODE]

    $post_array = preg_split('/(<!--ec1-->.*?<!--c2-->)/',
$gelen, 65535, PREG_SPLIT_DELIM_CAPTURE |  PREG_SPLIT_NO_EMPTY);
        for ($i=0; $i<=count($post_array); $i++){
            if(strstr($post_array&#91;$i&#93;,'<!--ec1-->'))
            $gelen=str_replace($post_array[$i],
            $this->ipsclass->vars['bl_hide_links_replace_code'], $gelen);
            }
        $row['post'] = $gelen;
    }
}

Now, go to IPB Control Panel -> Tools & Settings -> XML settings file tools
and, upload this XML file: ipb_settings_partial.zip

Everything is done.