Nyan Posted November 11, 2016 Share Posted November 11, 2016 I set the following code in /includes/hooks/. addSidebar.php <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondarySidebar', 2, function(MenuItem $secondarySidebar) { $secondarySidebar->getChild('Support') ->removeChild('Network Status'); }); And if I check Private in Knowledgebase, I meet the following error. Fatal error: Call to a member function removeChild() on null in /WHMCS/includes/hooks/addSidebar.php on line 6 Please tell me how to resolve. 0 Quote Link to comment Share on other sites More sharing options...
Nyan Posted November 11, 2016 Author Share Posted November 11, 2016 I change addSidebar.php as the following. But if I check Private in Knowledgebase, I meet the following error. <?php use WHMCS\View\Menu\Item as MenuItem; if (App::getCurrentFilename() == 'supporttickets') { add_hook('ClientAreaSecondarySidebar', 2, function(MenuItem $secondarySidebar) { $secondarySidebar->getChild('Support') ->removeChild('Network Status'); }); } if (App::getCurrentFilename() == 'announcements') { add_hook('ClientAreaSecondarySidebar', 2, function(MenuItem $secondarySidebar) { $secondarySidebar->getChild('Support') ->removeChild('Network Status'); }); } if (App::getCurrentFilename() == 'knowledgebase') { add_hook('ClientAreaSecondarySidebar', 2, function(MenuItem $secondarySidebar) { $secondarySidebar->getChild('Support') ->removeChild('Network Status'); }); } 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted November 11, 2016 Share Posted November 11, 2016 change addSidebar.php content to: <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondarySidebar', 2, function(MenuItem $secondarySidebar){ if (!is_null($secondarySidebar->getChild('Support'))){ if (!is_null($secondarySidebar->getChild('Support')->getChild('Network Status'))){ $secondarySidebar->getChild('Support')->removeChild('Network Status'); } } }); 0 Quote Link to comment Share on other sites More sharing options...
Nyan Posted November 11, 2016 Author Share Posted November 11, 2016 Thank you sentq. I can resolve. 0 Quote Link to comment Share on other sites More sharing options...
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.