zefiux Posted February 14, 2012 Posted February 14, 2012 Open this: lib/class.modulefactory.php And add this: public static function moderatorFactory(&$db, &$tpl, &$player, $module='Index') { if (file_exists (MODERATOR_DIR . '/' . $module . '/index.php')) { include_once (MODERATOR_DIR . '/' . $module . '/index.php'); $classname = 'Moderator_' . $module; return new $classname($db, $tpl, $player); } else { include_once (MODERATOR_DIR . '/Index/index.php'); return new Moderator_Index($db, $tpl, $player); } } After this: include_once (ADMIN_DIR . '/Index/index.php'); return new Admin_Index($db, $tpl, $player); } } Now make new folder(in same folder as Hooks, smart, modules) called moderator(or just make copy of admin folder). create index.php <?php define('IN_EZRPG', true); require_once '../init.php'; //Require moderator rank if ($player->rank < 5) { header('Location: ../index.php'); exit; } $default_mod = 'Index'; $module_name = ( (isset($_GET['mod']) && ctype_alnum($_GET['mod'])) ? $_GET['mod'] : $default_mod ); //moderator header hook $module_name = $hooks->run_hooks('moderator_header', $module_name); //Begin module $module = ModuleFactory::moderatorFactory($db, $tpl, $player, $module_name); $module->start(); //Admin footer hook $hooks->run_hooks('moderator_footer', $module_name); ?> And then create directory index, and index.php inside it <?php defined('IN_EZRPG') or exit; /* Class: Moderator_Index Home page for the admin panel. */ class Moderator_Index extends Base_Module { /* Function: start Displays moderator/index.tpl */ public function start() { $this->tpl->display('moderator/index.tpl'); } } ?> Basic moderator panel without any modules. If want add any just copy paste them from admin folder. now go to smarty/templates folder and make exact copy of admin folder. change whole index.tpl to this {include file="moderator/header.tpl" TITLE="Moderator"} <h1>Moderator</h1>> <h2>Moderator Modules</h2> <ul> <li><a href="index.php?mod=Members">Member Management</a></li> </ul> <p> If you install extra moderator modules, edit <em>smarty/templates/moderator/index.tpl</em> to add links above. </p> {include file="moderator/footer.tpl"} Whola, you have your own moderator panel. Like this we can make diffrent ranks like Noob-Moderator, Moderator, Super Moderator, Admin, Super Admin, Owner, each having it owns Panel, with diffrent features. Enjoy ;) Note: this is just simple copy+paste with some editing needed. Just saving your time from long searching. Quote
Spudinski Posted February 14, 2012 Posted February 14, 2012 Nice job, man. Would be nice if you could expand it with a couple of example modules as well. Quote
LearningCoder Posted February 14, 2012 Posted February 14, 2012 Very nice I might use this :) how much would it cost for you to make me more mods? Quote
zefiux Posted February 15, 2012 Author Posted February 15, 2012 Nice job, man. Would be nice if you could expand it with a couple of example modules as well. If you want any modules like bot editing/mission editing, just add their folders from admin modules to moderator modules Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.