Mopzilla Posted November 23, 2020 Share Posted November 23, 2020 Hello, I am trying to remove the menu items such as "Announcements" and "Knowledgebase" from my navbar. I don't use WHMCS for the front of my site and I basically give it to my customers so I can bill them (therefore I want to disable as much unnecessary stuff as possible). I cannot see anywhere to do this in the admin panel, and searching on Google found solutions to this issue which involve hooks. I have tried to implement these in a custom template under includes/hook but it doesn't seem to work. I don't know if the community posts I looked at were just out dated and the solution has changed, or if I am doing something wrong. So I thought I would create an account and ask myself. Thanks for any help! 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Technical Analyst II WHMCS SamP Posted November 24, 2020 WHMCS Technical Analyst II Share Posted November 24, 2020 Hi @Mopzilla You can remove a nav menu item as follows: <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { $primaryNavbar = Menu::primaryNavbar(); $primaryNavbar->removeChild('Announcements'); $primaryNavbar->removeChild('Knowledgebase'); }); More information is available in this article: https://docs.whmcs.com/Client_Area_Navigation_Menus_Cheatsheet#Hiding.2FRemoving_a_Menu_Item 0 Quote Link to comment Share on other sites More sharing options...
Mopzilla Posted November 24, 2020 Author Share Posted November 24, 2020 That hasn't worked, I am wondering if I have this file in the correct place, or maybe I need to reset my WHMCS installations cache so it updates? I am placing that in a file named "navbar.php" within templatename/includes/hook(s)/navbar.php I tried the word "hook" and "hooks" with no success. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 24, 2020 Share Posted November 24, 2020 two separate hooks - really ? 🙄 On 23/11/2020 at 12:25, Mopzilla said: I cannot see anywhere to do this in the admin panel, and searching on Google found solutions to this issue which involve hooks. I have tried to implement these in a custom template under includes/hook but it doesn't seem to work. they would go in the /includes/hooks folder of your WHMCS install, not within the templates folder. additionally, you can hide them using CSS in /css/custom.css if you wanted to. #Primary_Navbar-Knowledgebase, #Primary_Navbar-Announcements { display: none; } bear in mind that if you're using Six (or a variant of it), to keep a copy of the custom.css file as it may get overwritten by the updater (I don't believe this will apply when you're using the '21' theme in v8.1). also, the hook and CSS posted above only deal with the navbar links when a client is not logged in - when they are logged in (and if they have access to the client area), then there will be different links available (navbar and sidebar) - again, to remove/hide them, you would use hooks or CSS. On 23/11/2020 at 12:25, Mopzilla said: I cannot see anywhere to do this in the admin panel they never included a menu manager when they added the Six template over five years ago - to manage the menu, you would a) need to use hooks, b) buy a third-party menu manager addon, c) check for existing hooks in these forums (virtually anything that you want to do will have been done and posted, or could be modified for a situation), or d) employ a developer to fix the menu... 1 Quote Link to comment Share on other sites More sharing options...
Mopzilla Posted November 24, 2020 Author Share Posted November 24, 2020 Wow, I sure feel dumb for trying to stick the hooks into my template folder. Thanks for the help, it's working perfectly now. I actually got the code to remove the items from a post/reply you made quite a while back. 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.