MyBB Community Forums

Full Version: Hardcoded Moderator Warnings
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello I'll show you how to make a Moderator warning for MyBB except there is a twist!

The script checks for last edit and if there is one it checks who it is. The user id is ran through database and checks the user rank if the person is allowed to post the moderated post.

First open
./inc/class_parser.php

look for
function parse_message($message, $options=array())
and under that there should be globals

add
$post,$db
make sure it ends with ;

then look for

$message = $this->parse_mycode($message, $this->options);

add above that add
			// Moderator Warning
			$list_allowed_groups = array('3','4');
			if($post['edituid']) {
				$query = $db->simple_select("users", "*", "uid='".$post['edituid']."'");
				$lastedit = $db->fetch_field($query, "usergroup");
				if(in_array($lastedit,$list_allowed_groups)) {
					$message = preg_replace('#\[mod\](.*?)\[/mod\]#si', "<div style=\"color:#b52135;background-color:#f6ced3;border:2px solid #b52135;padding:10px;margin:10px;\"><u><b>Warning:</b></u> $1</div>", $message);
				}
			}

The part where YOU get to edit is

$list_allowed_groups = array('3','4');

usually 3 is Super Moderators and 4 is Administrators

you can also add 6 if you want (Moderators)

Just know that when the user edits their post, the [mod] will not work. You will have to re submit it again.
OK. but if a mod places a modcall on a post will that be visible / editable to the originator of the post? In that case he can simply delete the modcall and update the post.

There is a plugin for this that doesn't show in-post modcalls in edit. Can that me implemented?