rob2 Posted April 6, 2016 Share Posted April 6, 2016 Hi, i had check many post about use hook to hide or remove the items at sidebar, but it seems those items are menus with hyperlink, and what is need to remove are not menu(hyperlink), for instance,the priirity at itcket and get epp code at domain, do you know how to hide them ? thank you 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 6, 2016 Share Posted April 6, 2016 for removing the "Get EPP Code" child link, use the code I posted in the thread below... http://forum.whmcs.com/showthread.php?90982-disable-client-get-epp-code&p=438838#post438838 for removing the "Priority" details from the sidebar, use... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) { if (!is_null($primarySidebar->getChild('Ticket Information'))) { $primarySidebar->getChild('Ticket Information') ->removeChild('Priority'); } }); 0 Quote Link to comment Share on other sites More sharing options...
rob2 Posted April 8, 2016 Author Share Posted April 8, 2016 Hi, may i ask a question, one is " if (!is_null($primarySidebar->getChild('Domain Details Management'))) { " , and this one is " if (!is_null($primarySidebar->getChild('Ticket Information'))) { " , how do you know it is "Details Management" or "Information" ? because i think try to remove the following 4 parts at support but no effect. Announcements Knowledgebase Downloads Network Status thank you 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 8, 2016 Share Posted April 8, 2016 Hi Rob, may i ask a question,one is " if (!is_null($primarySidebar->getChild('Domain Details Management'))) { " , and this one is " if (!is_null($primarySidebar->getChild('Ticket Information'))) { " , how do you know it is "Details Management" or "Information" ? because i think try to remove the following 4 parts at support but no effect. Announcements Knowledgebase Downloads Network Status http://docs.whmcs.com/Client_Area_Navigation_Menus_Cheatsheet#Finding_a_Menu_Item_Name Every menu item has a unique name that is used to reference it. You will need this name in order to manipulate it. To make it easier, we have made the name of each menu item available in the HTML source of the page, which means it can be retrieved using the Inspect Element option available in most modern browsers. so what I would do is to view the source of the page in the browser and use that to find the menuitem names... <li menuItemName="Support" class="dropdown" id="Primary_Navbar-Support"> <a class="dropdown-toggle" data-toggle="dropdown" href="#"> Support <b class="caret"></b> </a> <ul class="dropdown-menu"> <li menuItemName="Tickets" id="Primary_Navbar-Support-Tickets"> <a href="supporttickets.php"> Tickets </a> </li> <li menuItemName="Announcements" id="Primary_Navbar-Support-Announcements"> <a href="announcements.php"> Announcements </a> </li> <li menuItemName="Knowledgebase" id="Primary_Navbar-Support-Knowledgebase"> <a href="knowledgebase.php"> Knowledgebase </a> </li> <li menuItemName="Downloads" id="Primary_Navbar-Support-Downloads"> <a href="downloads.php"> Downloads </a> </li> <li menuItemName="Network Status" id="Primary_Navbar-Support-Network_Status"> <a href="serverstatus.php"> Network Status </a> from the above code, I then know that it's a primary navbar and the names of the "Support" menuitem and all of its children. if you wanted to remove the four items you mention, you would do this... <?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('Announcements') ->removeChild('Knowledgebase') ->removeChild('Downloads') ->removeChild('Network Status'); } }); by default, this "Support" navbar item only exists when the client is logged in - therefore, you don't really need to check in the action hook if they're logged in or not... though there would be no harm in checking if they are logged in if you wanted to be sure. 0 Quote Link to comment Share on other sites More sharing options...
rob2 Posted April 8, 2016 Author Share Posted April 8, 2016 Hi, thanks for your explain and i understnad more, but it seems the hook file has no effect to hide those items, may you help me check it ? thank you again. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 8, 2016 Share Posted April 8, 2016 Hi Rob, thanks for your explain and i understnad more,but it seems the hook file has no effect to hide those items, may you help me check it ? the hook works fine - but I misread your question and thought you were asking about the navbar and not sidebars... my mistake. to remove these items from a sidebar, the code is the same - you just you a different hook... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondardySidebar) { if (!is_null($secondardySidebar->getChild('Support'))) { $secondardySidebar->getChild('Support') ->removeChild('Announcements') ->removeChild('Knowledgebase') ->removeChild('Downloads') ->removeChild('Network Status'); } }); apologies for the confusion. 0 Quote Link to comment Share on other sites More sharing options...
HostGenius Posted June 24, 2016 Share Posted June 24, 2016 thank you brain for this hook 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.