2009-11-15, 01:01 AM
It *almost* works but it refuses to uhm, how do I say, parse the other message. I have two mod warning types and at times it may be necessary to use both.
Here is the code I used for parsing.
And then, for the regex.
Edit: Sorry for posting in the wrong section along with I found another error. It will not parse to non-moderators. I want them to be able to *see* the message but not actually post one. :/
Here is the code I used for parsing.
global $mybb;
if($mybb->settings['modwarn_enabled'] == '1'){
$theIcon = ($match['1'] == "Warning") ? 'exclamation' : 'information';
return "<table width=\"100%\" id=\"modwarn_$match[1]\">
<tr>
<td width=\"5%\" align=\"center\" valign=\"middle\" class=\"$match[1]img\">
<img src=\"".$mybb->settings['bburl']."/images/icons/$theIcon.gif\" alt=\"Moderator $match[1]\" />
</td>
<td width=\"95%\" valign=\"middle\">
<strong>Moderator $match[1]</strong>:<br />
$match[2]
</td>
</tr>
</table>";
}else{
return "<!-- ModWarn Function Disabled -->";
}
And then, for the regex.
$pat = "!\[modwarn=(.*?)](.*)\[/modwarn]!Us";
return preg_replace_callback($pat, "modwarn__filter", $message);
Edit: Sorry for posting in the wrong section along with I found another error. It will not parse to non-moderators. I want them to be able to *see* the message but not actually post one. :/