CobbyJ Posted December 28, 2017 Share Posted December 28, 2017 (edited) Hello, In my hooks im trying to add 2 hooks add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) and if add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar) But i keep getting an error. does anyone know the correct to code it. My current file is ------------------------------------------------------------------------------------------------------------------------------------- <?php if ( !defined('WHMCS')) { header("Location: ../../index.php"); } use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Network Status'))) { $primaryNavbar->removeChild('Network Status'); } if (!is_null($primaryNavbar->getChild('Announcements'))) { $primaryNavbar->removeChild('Announcements'); } if (!is_null($primaryNavbar->getChild('Knowledgebase'))) { $primaryNavbar->removeChild('Knowledgebase'); } if (!is_null($primaryNavbar->getChild('Contact Us'))) { $primaryNavbar->removeChild('Contact Us'); } if (!is_null($primaryNavbar->getChild('Store'))) { $primaryNavbar->removeChild('Store'); } if (!is_null($primaryNavbar->getChild('Home'))) { $primaryNavbar->removeChild('Home'); } }); ------------------------------------------------------------------------------------------------------------------------------------- I want to add this ------------------------------------------------------------------------------------------------------------------------------------- use WHMCS\View\Menu\Item as MenuItem; if add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar) { $client = Menu::context('client'); if (!is_null($client)) { if (!is_null($secondarySidebar->getChild('Support'))) { $secondarySidebar->getChild('Support') ->removeChild('Announcements') ->removeChild('Knowledgebase') ->removeChild('Downloads') ->removeChild('Network Status') ->removeChild('Open Ticket'); } } }); ------------------------------------------------------------------------------------------------------------------------------------- Any help would be greatful. Edited December 28, 2017 by WHMCS ChrisD Moved code into code box, please use the <> button to add in the future Link to comment Share on other sites More sharing options...
sentq Posted December 28, 2017 Share Posted December 28, 2017 change sidebar code to this: add_hook('ClientAreaSecondarySidebar', 1, function($secondarySidebar) { $client = Menu::context('client'); if (!is_null($client) && !is_null($secondarySidebar->getChild('Support'))) { $support = $secondarySidebar->getChild('Support'); if (!is_null($support->getChild('Announcements'))){ $support->removeChild('Announcements'); } if (!is_null($support->getChild('Knowledgebase'))){ $support->removeChild('Knowledgebase'); } if (!is_null($support->getChild('Downloads'))){ $support->removeChild('Downloads'); } if (!is_null($support->getChild('Network Status'))){ $support->removeChild('Network Status'); } if (!is_null($support->getChild('Open Ticket'))){ $support->removeChild('Open Ticket'); } } }); Link to comment Share on other sites More sharing options...
Recommended Posts