Jump to content

Menu Hook


Recommended Posts

Sharing this here since I built it and know it's compatible with a Vanilla install of ezRPG-Rework, but should also be fully compatible with vanilla ezRPG1.0.2.

Here we have hooks for the menu: New short codes are {$TOP_MENU} and {$TOP_ADMIN_MENU}

09.menu.php store in hooks directory

defined('IN_EZRPG') or exit;

if (defined('IN_ADMIN'))
$hooks->add_hook('admin_header', 'menu_admin');
$hooks->add_hook('header', 'menu_players');

function hook_menu_players(&$db, $config, &$tpl, &$player, $args = 0) {
if($player == null) 
$menu = "<ul>";
$menu .= "<li><a href='index.php'>Home</a></li>";
$menu .= "<li><a href='ndex.php?mod=Register'>Register</a></li>";
$menu .= "</ul>";
} else {
$menu = "<ul>";
$menu .= "<li><a href='index.php'>Home</a></li>";
$menu .= "<li><a href='index.php?mod=EventLog'>Log</a></li>";
$menu .= "<li><a href='index.php?mod=City'>City</a></li>";
$menu .= "<li><a href='index.php?mod=Members'>Members</a></li>";
$menu .= "<li><a href='index.php?mod=AccountSettings'>Account</a></li>";
$menu .= "<li><a href='index.php?mod=Logout'>Log Out</a></li>";
$menu .= "</ul>";
$tpl->assign('TOP_MENU', $menu);
return $args;
function hook_menu_admin(&$db, $config, &$tpl, &$player, $args = 0) {
$menu = "<ul>";
$menu .= "<li><a href='index.php'>Admin</a></li>";
$menu .= "<li><a href='index.php?mod=Members'>Members</a></li>";
$menu .= "<li><a href='../index.php'>Back</a></li>";
$menu .= "<li><a href='../index.php?mod=Logout'>Log Out</a></li>";
$menu .= "</ul>";
$tpl->assign('TOP_ADMIN_MENU', $menu);
return $args;


Replace the {If Logged_In } blah blah blah code in the header template file.

Currently this makes you wonder why make the change since it's basically doing the same thing, but as we're discussing at ezrpgproject, this will lead into using our modules/plugins to dynamically affect the menu. Just looking at this, you'll see that we've opened up api to the player, db, config, etc.

Edited by uaktags
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...