tsupan Posted April 15, 2017 Share Posted April 15, 2017 Hi I need help on how to remove the "knowledgebase" from the menu. Can anyone tell me how do i do that ? I tred the below in hooks/menu.php but doesnt work. <?php add_hook('ClientAreaNavbars', 1, function () { Get the current navigation bars. $primaryNavbar = Menu::primaryNavbar(); if (!is_null($primaryNavbar->getChild('Support'))) { $primaryNavbar->getChild('Knowledgebase') ->removeChild('Knowledgebase');} 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 15, 2017 Share Posted April 15, 2017 that's close, but it should be... <?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('Support'))) { $primaryNavbar->getChild('Support') ->removeChild('Knowledgebase'); } }); the first block removes the KB link for users not logged in... the second one removes it from the Support menu for those that are. 1 Quote Link to comment Share on other sites More sharing options...
tsupan Posted April 15, 2017 Author Share Posted April 15, 2017 nice...works like a charm! 1 Quote Link to comment Share on other sites More sharing options...
ManagedCloud-Hosting Posted January 12, 2020 Share Posted January 12, 2020 Can't we hide knowledgebase and announcements for users not logged in from Admin Area settings ? Thanks :) 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 12, 2020 Share Posted January 12, 2020 6 minutes ago, VirtualWorldGlobal said: Can't we hide knowledgebase and announcements for users not logged in from Admin Area settings ? do you think I would have written the hooks if we could. 🙂 you could hide knowledgebase articles for users not logged in by marking them private, but there is no similar option for announcements. 0 Quote Link to comment Share on other sites More sharing options...
ManagedCloud-Hosting Posted January 12, 2020 Share Posted January 12, 2020 (edited) I ticked and saved the knowledgebase articles as PRIVATE but they are still showing. any other settings I need to change ? Edited January 12, 2020 by VirtualWorldGlobal 0 Quote Link to comment Share on other sites More sharing options...
ManagedCloud-Hosting Posted January 12, 2020 Share Posted January 12, 2020 21 minutes ago, VirtualWorldGlobal said: I ticked and saved the knowledgebase articles as PRIVATE but they are still showing. any other settings I need to change ? With showing I mean that the KB Subject is visible but when we click on it to read that requires login 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 12, 2020 Share Posted January 12, 2020 (edited) 25 minutes ago, VirtualWorldGlobal said: I ticked and saved the knowledgebase articles as PRIVATE but they are still showing. any other settings I need to change ? sounds like it's cacheing or you're already logged in as a client... marking an article as private should require you to login if you aren't already logged in. 2 minutes ago, VirtualWorldGlobal said: With showing I mean that the KB Subject is visible but when we click on it to read that requires login that sounds about right - out of the box, you can't make categories private, only their articles. Edited January 12, 2020 by brian! 0 Quote Link to comment Share on other sites More sharing options...
ManagedCloud-Hosting Posted January 12, 2020 Share Posted January 12, 2020 Hi, Thank you so much, this served my purpose <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Knowledgebase'))) { $primaryNavbar->removeChild('Knowledgebase'); } }); I also want to hide announcements, what needs to be done ? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 12, 2020 Share Posted January 12, 2020 8 minutes ago, VirtualWorldGlobal said: I also want to hide announcements, what needs to be done ? bear in mind that the above code simply removes the link in the navbar... if they know the URL of the main page, or even an non-private article, they could still go to that page if they want to. to hide the announcements link, add the above after the if statement above... if (!is_null($primaryNavbar->getChild('Announcements'))) { $primaryNavbar->removeChild('Announcements'); } remembering that you're just removing the links for non-logged in users - the kb/announcement links will still be there for users that are logged in. and if you want to remove announcements from the homepage if using Six)... 0 Quote Link to comment Share on other sites More sharing options...
ManagedCloud-Hosting Posted January 12, 2020 Share Posted January 12, 2020 Thank you removed Announcements using the code you gave... 0 Quote Link to comment Share on other sites More sharing options...
ManagedCloud-Hosting Posted January 22, 2020 Share Posted January 22, 2020 Hi How you recommend hiding support from the logged in users ? Seems we have to hide that for now...thank you 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 22, 2020 Share Posted January 22, 2020 2 minutes ago, VirtualWorldGlobal said: How you recommend hiding support from the logged in users ? in the navbar? it's just using the same technique as the others.. if (!is_null($primaryNavbar->getChild('Support'))) { $primaryNavbar->removeChild('Support'); } 0 Quote Link to comment Share on other sites More sharing options...
ManagedCloud-Hosting Posted January 22, 2020 Share Posted January 22, 2020 As per your guidance I was able to do that. Thank you :) 0 Quote Link to comment Share on other sites More sharing options...
CL IT Service Posted February 2, 2020 Share Posted February 2, 2020 Hi guys, i need help, i removed allready the links Knowledgebase and announcement. do done the same with Network Status and it is not working. i put every link in seperated file, so for three links to remove i have tree files menu1, menu2, menu3 I saved a copy of the working files and just changed the name. also i want remove the dropdown menu " shop" and all items in There should be directly in navbar. Please help me to resolve this problem. 0 Quote Link to comment Share on other sites More sharing options...
ManagedCloud-Hosting Posted February 3, 2020 Share Posted February 3, 2020 (edited) @CL IT Service Can you please try this at your end. All Thanks to brian! <?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('Network Status'))) { $primaryNavbar->getChild('Network Status') ->removeChild('Network Status'); } }); Edited February 3, 2020 by VirtualWorldGlobal 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 3, 2020 Share Posted February 3, 2020 14 hours ago, CL IT Service said: i put every link in seperated file, so for three links to remove i have tree files menu1, menu2, menu3 we would ideally need to see the hook codes used and your site because depending on if your site is using a custom theme, you may need to edit template files rather than hooks to remove certain menu links (e.g depends if it's a theme-based menu or a WHMCS navbar menu). 0 Quote Link to comment Share on other sites More sharing options...
CL IT Service Posted February 3, 2020 Share Posted February 3, 2020 i solved it allready to remove knowledgebar etc. but now i just need to add the childs of shop to primary navbar. Domain register and domein transfer and hosting products. i used the example from here to remove the links. yes i use an costum template "Flowhost" but for hooks i dont need to modify template here 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 4, 2020 Share Posted February 4, 2020 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.