Jump to content

[Tut]Moderator Panel


Recommended Posts

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);
           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


define('IN_EZRPG', true);

require_once '../init.php';

//Require moderator rank
if ($player->rank < 5)
   header('Location: ../index.php');

$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);

//Admin footer hook
$hooks->run_hooks('moderator_footer', $module_name);


And then create directory index, and index.php inside it


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()


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"}


<h2>Moderator Modules</h2>
       <li><a href="index.php?mod=Members">Member Management</a></li>

If you install extra moderator modules, edit <em>smarty/templates/moderator/index.tpl</em> to add links above.

{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 ;)


this is just simple copy+paste with some editing needed. Just saving your time from long searching.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...