MyBB Community Forums

Full Version: My plugin doesn't work (:
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.

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. :/
Well... this really should be in the plugin development forum. But I'm sure a mod will come along and move it there shortly. Other than that, I'll have to take a look at this in the AM when I'm fresh. I can't wrap my mind around anything at the moment. I've only had 3 hours of sleep in the past 48. I need to get to bed soon despite the early hour. So, if no one has helped you by whenever I get here tomorrow I'll take another look. Good luck!
Oops sorry. Didn't mean to post in the wrong section.

Edit:

I fixed the display error. though I can't figure out how to get normal people to view it. D:
I have the same problem with my mod to allow users to post HTML. You're probably checking the current user rather than the poster.