J
J.Black
Guest
This Plugin will allow you to only registered users can view "code" (PHP, HTML and CODE bbCodes).
Create a new plugin
Name: vBcode CODE only for Registered
Hook: bbcode_parse_start
Code Plugin:
Create a new plugin
Name: vBcode CODE only for Registered
Hook: bbcode_parse_start
Code Plugin:
PHP:
global $vbulletin;
// bbcode_code
if ($vbulletin->userinfo['userid'] == 0)
{
if (!function_exists('bbcode_only_reg_code'))
{
function bbcode_only_reg_code($string)
{
$array_bbcodes = array('#\[code\](.*?)\[\/code\]#si','#\[CODE\](.*?)\[\/CODE\]#si');
foreach($array_bbcodes AS $array_bbcode)
{
$match_count = preg_match_all($array_bbcode, $string, $matches);
$replacement_code = "Content Visible For Registered And Active Users";
for( $i = 0; $i < $match_count; $i++ )
{
$after_replace = $matches[1][$i];
$array_after_replace = array('
Code:
' . $after_replace . '
','
Code:
' . $after_replace . '
');
$string = str_replace($array_after_replace,$replacement_code,$string);
}
}
return $string;
} // end function
}
$text = bbcode_only_reg_code($text);
$parsedtext = bbcode_only_reg_code($parsedtext);
}