OK, I found one error in the last plugin. The preview and reviewed posts were working right but the editor text wasn't. Here's the corrected code:
Code:
//ini_set('display_errors', '1');
$test = preg_match_all('#\[restricted\]([\s\S]*?)\[/restricted\]#i', $threadreviewbits, $matches);
$style = "
background:#ffffcc;
border:1px solid black;
padding:6px;
color:red;
";
$open_tag ='<div style="' . $style . '">';
$close_tag = '</div>';
if($test)
{
for($i = 0; $i < count($matches[0]); $i++)
{
if(is_member_of($vbulletin->userinfo, array(6,7)))
{
$threadreviewbits = preg_replace('#' . preg_quote($matches[0][$i]) . '#', $open_tag . $matches[1][$i] . $close_tag, $threadreviewbits);
}
else
{
$threadreviewbits = preg_replace('#' . preg_quote($matches[0][$i]) . '#', '', $threadreviewbits);
}
}
}
$test = preg_match_all('#\[restricted\]([\s\S]*?)\[/restricted\]#i', $postpreview, $matches);//was $postpreview
$style = "
background:#ffffcc;
border:1px solid black;
padding:6px;
color:red;
";
$open_tag ='<div style="' . $style . '">';
$close_tag = '</div>';
if($test)
{
for($i = 0; $i < count($matches[0]); $i++)
{
if(is_member_of($vbulletin->userinfo, array(6,7)))
{
$postpreview = preg_replace('#' . preg_quote($matches[0][$i]) . '#', $open_tag . $matches[1][$i] . $close_tag, $postpreview);
}
else
{
$postpreview = preg_replace('#' . preg_quote($matches[0][$i]) . '#', '', $postpreview);
}
}
}
if(!is_member_of($vbulletin->userinfo, array(6,7)))
{
$messagearea = preg_replace('#\[restricted\]([\s\S]*?)\[/restricted\]#i', '', $messagearea);
}