Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
fix(menu): fixed to be shown only when being logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiSchwarz-cnic committed Jun 15, 2020
1 parent e6c572a commit 302d221
Showing 1 changed file with 26 additions and 23 deletions.
49 changes: 26 additions & 23 deletions hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,33 @@
use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) {
$key = "ispapibackorder";
$language = (isset($_SESSION["Language"]) ? $_SESSION["Language"] : "english");
$file = getcwd() . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR . "addons" . DIRECTORY_SEPARATOR . $key . DIRECTORY_SEPARATOR . "lang" . DIRECTORY_SEPARATOR . $language . ".php";
if (file_exists($file)) {
include($file);
}

$primaryNavbar->addChild($key, array(
"label" => $_ADDONLANG["backorder_nav"],
"uri" => "index.php?m={$key}&p=manage",
"order" => "70"
));

$pc = $primaryNavbar->getChild($key);
if (!is_null($pc)) {
$pc->addChild($key . "_manage", array(
"label" => $_ADDONLANG["managebackorders"],
$client = Menu::context('client');
if ($client) {
$key = "ispapibackorder";
$language = (isset($_SESSION["Language"]) ? $_SESSION["Language"] : "english");
$file = getcwd() . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR . "addons" . DIRECTORY_SEPARATOR . $key . DIRECTORY_SEPARATOR . "lang" . DIRECTORY_SEPARATOR . $language . ".php";
if (file_exists($file)) {
include($file);
}

$primaryNavbar->addChild($key, array(
"label" => $_ADDONLANG["backorder_nav"],
"uri" => "index.php?m={$key}&p=manage",
"order" => "20"
));
$pc->addChild($key . "_droplist", array(
"label" => $_ADDONLANG["domainheader"],
"uri" => "index.php?m={$key}&p=dropdomains",
"order" => "10"
"order" => "70"
));

$pc = $primaryNavbar->getChild($key);
if (!is_null($pc)) {
$pc->addChild($key . "_manage", array(
"label" => $_ADDONLANG["managebackorders"],
"uri" => "index.php?m={$key}&p=manage",
"order" => "20"
));
$pc->addChild($key . "_droplist", array(
"label" => $_ADDONLANG["domainheader"],
"uri" => "index.php?m={$key}&p=dropdomains",
"order" => "10"
));
}
}
});

0 comments on commit 302d221

Please sign in to comment.