Rigsby Posted May 5, 2017 Share Posted May 5, 2017 Greetings I would like to hide a few links from the navbar and sidebar. I can't quite seem to find the correct hook/s, and I've been searching everywhere. I have managed to hide a few items under the Support dropdown (Announcements, Knowledgebase and Downloads), but it's the single links for Announcements and Knowledgebase in the navbar that I can't seem to crack, and I also have not yet found a solution for the sidebar. Please can someone help? Many thanks in advance 0 Quote Link to comment Share on other sites More sharing options...
Rigsby Posted May 6, 2017 Author Share Posted May 6, 2017 Additionally, I am also trying to find a way to hide navbar links pre-login (I don't yet have a Knowledgebase; Home is redundant because that's the page that is loaded; Announcements I can use but only for logged in clients). If anyone could help that would be great. Thanks 0 Quote Link to comment Share on other sites More sharing options...
Rigsby Posted May 6, 2017 Author Share Posted May 6, 2017 I have just spent the best £21 I will ever spend. It's a module for the navbar, and it.. is.. awesome! Search for WHMCS Advanced Menu Manager. The only downside, unless I haven't seen the option for it yet, is that it doesn't work with the sidebar. I wish I had known about this app 18 hours ago because I would be in bed instead of being up until 5am Zzzz They should pay me commission Tomorrow, I'm on the hunt for modules! What else is out there that are timesavers? Any ideas would be great 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 6, 2017 Share Posted May 6, 2017 one simple thing to remember is that removing navbar children and sidebar children is basically exactly the same process - you just use different specific hooks to do it.... and always check that the sidebar/navbar exists before trying to remove/modify it. with regards to the navbar/sidebar, if you wanted to do both as one hook... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Knowledgebase'))) { $primaryNavbar->removeChild('Knowledgebase'); } if (!is_null($primaryNavbar->getChild('Announcements'))) { $primaryNavbar->removeChild('Announcements'); } }); add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar) { if (!is_null($secondarySidebar->getChild('Support'))) { $secondarySidebar->getChild('Support') ->removeChild('Announcements') ->removeChild('Knowledgebase'); } }); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 6, 2017 Share Posted May 6, 2017 I have just spent the best £21 I will ever spend. It's a module for the navbar, and it.. is.. awesome! Search for WHMCS Advanced Menu Manager. The only downside, unless I haven't seen the option for it yet, is that it doesn't work with the sidebar. I wish I had known about this app 18 hours ago because I would be in bed instead of being up until 5am Zzzz WHMCS should have done something similar when they introduced the feature in v6 - but they expect everyone to learn how to write hooks to modify menus... or pay someone to do it. 0 Quote Link to comment Share on other sites More sharing options...
rottenteeth Posted February 7, 2021 Share Posted February 7, 2021 Hi, actually I made this hook, but the RSS Feed doesn't not dissapper. Could you give me some advice what I'm doing wrong? I don't know which hook is correct, but all of this do not remove View RSS Feed from Announcements. <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Announcements'))) { $primaryNavbar->getChild('Announcements') ->removeChild('View RSS Feed'); } }); add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $secondarNavbar) { if (!is_null($secondarNavbar->getChild('Announcements'))) { $secondarNavbar->getChild('Announcements') ->removeChild('View RSS Feed'); } }); add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { if (!is_null($primarySidebar->getChild('Announcements'))) { $primarySidebar->getChild('Announcements') ->removeChild('View RSS Feed'); } }); add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar) { if (!is_null($secondarySidebar->getChild('Announcements'))) { $secondarySidebar->getChild('Announcements') ->removeChild('View RSS Feed'); } }); 0 Quote Link to comment Share on other sites More sharing options...
rottenteeth Posted February 8, 2021 Share Posted February 8, 2021 Hi, actually I made this hook, but the RSS Feed doesn't not dissapper. Could you give me some advice what I'm doing wrong? 0 Quote Link to comment Share on other sites More sharing options...
rottenteeth Posted February 24, 2021 Share Posted February 24, 2021 This one is resolved in my another post, please close this topic. 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.