CCSupport Posted November 25, 2015 Share Posted November 25, 2015 Hello all, I would like to remove some of the menu items on the main Nav & sidebar within WHMCS v6. After reading this page I am pretty confused as to how to simply remove the link/item altogether. In essence, I need to remove Network Status from the 'Support' dropdown including the sidebar and also want to remove the 'Order Hosting' from the main homepage where it states "How can we help today?" Any assistance or guidance to the right file(s) would be appreciated. 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted November 25, 2015 Share Posted November 25, 2015 to remove items from the navigation or sidebar you need to use ActionHooks for that purpose, and here exactly how you can do that: http://docs.whmcs.com/Client_Area_Navigation_Menus_Cheatsheet#Hiding.2FRemoving_a_Menu_Item http://docs.whmcs.com/Client_Area_Sidebars_Cheatsheet#Hiding.2FRemoving_a_Sidebar_Menu_Item 1 Quote Link to comment Share on other sites More sharing options...
CCSupport Posted November 25, 2015 Author Share Posted November 25, 2015 Fantastic, thank you - - - Updated - - - Just to check, as I have never added hooks before, do I need to name the .php file something specific or can it be anything as long as it is in the /hooks folder? I ask as I have just created a file named 'removenetwork.php' and added the remove network status example code but it did nothing....guessing I am missing something! 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted November 25, 2015 Share Posted November 25, 2015 your file name is OK ( {filename}.php ), maybe the issue within your code it self, you can share it here 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Josh Posted November 25, 2015 Share Posted November 25, 2015 I did some quick testing on my WHMCS installation and was able to get the following hook function working to remove the 'Network Status' submenu item from the 'Support' menu. <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Support'))) { $primaryNavbar->getChild('Support')->removeChild('Network Status'); } }); I simply placed this inside the /includes/hooks directory in a file called remove_network_status.php 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 25, 2015 Share Posted November 25, 2015 want to remove the 'Order Hosting' from the main homepage where it states "How can we help today?" this one will be a template edit - six/header.tpl - remove the following... <li> <a id="btnOrderHosting" href="cart.php"> <i class="fa fa-hdd-o"></i> <p> {$LANG.orderhosting} <span>»</span> </p> </a> </li> 0 Quote Link to comment Share on other sites More sharing options...
CCSupport Posted November 25, 2015 Author Share Posted November 25, 2015 Many thanks for the help with this one. I have managed, with the code above, to remove the Network Status on the top Nav bar, thank you! I am having an issue with the sidebar though. This is what I thought would have worked but only breaks the site: <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { $primarySidebar->getChild('Support') ->removeChild('Network Status'); }); - - - Updated - - - Thanks Brian. I decided to just change the wording so it fits with what's on offer rather than hosting...thanks 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 25, 2015 Share Posted November 25, 2015 I am having an issue with the sidebar though. This is what I thought would have worked but only breaks the site. lots of the code examples in the v6 docs will do this. the basic rule to follow is that you need to check if the menu/sidebar etc exists - and only if it does, can you modify it... if you try to modify something that doesn't exist, that's when you get a blank page... http://forum.whmcs.com/showthread.php?104955-Using-hooks-to-change-sidebar-menus-works-on-some-pages-blank-screens-on-others&p=432506#post432506 0 Quote Link to comment Share on other sites More sharing options...
CCSupport Posted November 25, 2015 Author Share Posted November 25, 2015 Thanks Brian. Nothing is working to get rid of what I wanted. Very much confused as everything I am trying to remove the 'Network Status' under the 'Support' sidebar is failing. The Support Sidebar only shows under the Support>Tickets & Support>Downloads pages it seems. I have removed near enough everything else required so I will leave it be I think...it only takes to a page that says no issues so I think it'll have to do! Thanks for your help 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted November 25, 2015 Share Posted November 25, 2015 how many thanks for Brian here can I have some? 1 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 25, 2015 Share Posted November 25, 2015 the sidebar @ Support>Tickets & Support>Downloads is a secondary sidebar and not a primary one - so you'd need to use the secondary sidebar hook... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar) { if (!is_null($secondarySidebar->getChild('Support'))) { $secondarySidebar->getChild('Support') ->removeChild('Network Status'); } }); tested locally and works. 1 Quote Link to comment Share on other sites More sharing options...
CCSupport Posted November 25, 2015 Author Share Posted November 25, 2015 Perfect...no wonder why it wasn't working! Ooops! Thanks Brian. And thank you Sentq ;-) 0 Quote Link to comment Share on other sites More sharing options...
CCSupport Posted November 25, 2015 Author Share Posted November 25, 2015 I'm still getting issues with these menus! Arrgghhhh I have changed the wording for 'Home' to 'Client Area Home' and I want to add another link that says 'Home' to link to the main website. I have looked at the adding of Primary menu items, however each time I add any code that I think would work it is breaking the site! Is the issue because I am trying to use 'Home' for the name again? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted November 26, 2015 Share Posted November 26, 2015 can you share your code if possible? it will help us identify the issue! 0 Quote Link to comment Share on other sites More sharing options...
CCSupport Posted November 26, 2015 Author Share Posted November 26, 2015 All sorted. Decided to use a $20 addon (The One)...it's pretty damn good too! Really easy to amend any part of the main menu 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.