martinezfer Posted October 25, 2020 Share Posted October 25, 2020 (edited) Hi, I'm trying to remove and add some menu items to the WHMCS template through hooks. I was able to add some but following same php files, for some reason, some did not work. Can someone advise what is wrong with these hook php files? 1-Adding "VPN" as submenu of "Hosting Main Menu" <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Hosting'))) { $primaryNavbar->getChild('Hosting') ->addChild('VPN', array( 'label' => 'VPN', 'uri' => 'https://.......', 'order' => '101', )); } }); 2-Remove "SSL Certificates" from submenu under "Store" <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Store'))) { $primaryNavbar->getChild('Store')->removeChild('SSL Certificates'); } }); Please advise Edited October 25, 2020 by martinezfer 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 26, 2020 Share Posted October 26, 2020 16 hours ago, martinezfer said: 1-Adding "VPN" as submenu of "Hosting Main Menu" if the hosting menu exists (i'm assuming another hook is creating it?), then the hook should work... it's possible that if this hook is running before the hook that creates the hosting menu runs, then it might not appear to work... but then I wouldn't have multiple sepaarate hook files modifying the menu - i'd consolidate them as one hook (or at least one file) so you have some idea what changes are being made in the one place. 16 hours ago, martinezfer said: 2-Remove "SSL Certificates" from submenu under "Store" in any recent version, I would expect the removeChild value to be 'symantec' instead of 'SSL Certificates'. 0 Quote Link to comment Share on other sites More sharing options...
martinezfer Posted October 28, 2020 Author Share Posted October 28, 2020 Thanks. Worked! 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.