Kiroge Posted October 28, 2015 Share Posted October 28, 2015 (edited) Hi guys, I succeeded to hide some menus most of primary menus using hooks by followed instruction provided on ' Client Area Navigation Menus Cheatsheet' section. However, I am stuck as I can't figure out how to hide other menu items on client area once she/he login on sidebar area. I would like to hide and be able to update later without loosing my changes. Here below are the screenshots of menu items which I would like to hide. dropbox.com/s/4c0w6z57urcfwze/menu1.png?dl=0 dropbox.com/s/keapl37poflti2g/menu2.png?dl=0 dropbox.com/s/9pl4vyooz4kubee/cart.png?dl=0 Help would be much appreciate. If you can provide me the codes and direction how and where to put it Thanks! Edited October 28, 2015 by Infopro Please Attach Images to Your Posts. 0 Quote Link to comment Share on other sites More sharing options...
Kiroge Posted October 29, 2015 Author Share Posted October 29, 2015 Hi guys, I succeeded to hide some menus most of primary menus using hooks by followed instruction provided on ' Client Area Navigation Menus Cheatsheet' section. However, I am stuck as I can't figure out how to hide other menu items on client area once she/he login on sidebar area. I would like to hide and be able to update later without loosing my changes. Here below are the screenshots of menu items which I would like to hide. dropbox.com/s/4c0w6z57urcfwze/menu1.png?dl=0 dropbox.com/s/keapl37poflti2g/menu2.png?dl=0 dropbox.com/s/9pl4vyooz4kubee/cart.png?dl=0 Help would be much appreciate. If you can provide me the codes and direction how and where to put it Thanks! Please see attached screenshots for my problems below: 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 29, 2015 Share Posted October 29, 2015 with regards to menu 1, if you wanted to remove the children for everyone (those links exist for both clients and non-clients), you could use the following... <?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('Announcements') ->removeChild('Knowledgebase') ->removeChild('Downloads') ->removeChild('Network Status') ->removeChild('Open Ticket'); } }); if you wanted to only remove these links in the client area, but keep them elsewhere, you could use the following... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar) { $client = Menu::context('client'); if (!is_null($client)) { if (!is_null($secondarySidebar->getChild('Support'))) { $secondarySidebar->getChild('Support') ->removeChild('Announcements') ->removeChild('Knowledgebase') ->removeChild('Downloads') ->removeChild('Network Status') ->removeChild('Open Ticket'); } } }); for menu 2, it's similar to the above - just go through the view source of the page to find the names of the menuitemname you want to remove and add them to a hook. for 3, that's a template edit - take a look at the <!-- Shopping Cart --> section of six/header.tpl 1 Quote Link to comment Share on other sites More sharing options...
Kiroge Posted October 29, 2015 Author Share Posted October 29, 2015 with regards to menu 1, if you wanted to remove the children for everyone (those links exist for both clients and non-clients), you could use the following... <?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('Announcements') ->removeChild('Knowledgebase') ->removeChild('Downloads') ->removeChild('Network Status') ->removeChild('Open Ticket'); } }); if you wanted to only remove these links in the client area, but keep them elsewhere, you could use the following... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar) { $client = Menu::context('client'); if (!is_null($client)) { if (!is_null($secondarySidebar->getChild('Support'))) { $secondarySidebar->getChild('Support') ->removeChild('Announcements') ->removeChild('Knowledgebase') ->removeChild('Downloads') ->removeChild('Network Status') ->removeChild('Open Ticket'); } } }); for menu 2, it's similar to the above - just go through the view source of the page to find the names of the menuitemname you want to remove and add them to a hook. for 3, that's a template edit - take a look at the <!-- Shopping Cart --> section of six/header.tpl Thank you very much Brian! So which file .php name should I use to save into hooks folder? 0 Quote Link to comment Share on other sites More sharing options...
Kiroge Posted October 29, 2015 Author Share Posted October 29, 2015 Hi Brian, Thank you very much your codes and instruction help me to hide menu items & shopping cart. I really appreciate your help! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 29, 2015 Share Posted October 29, 2015 Thank you very much Brian! So which file .php name should I use to save into hooks folder? you can call it anything you like, but it may help to make the filename represent what it does - e.g., supportsidebar.php 0 Quote Link to comment Share on other sites More sharing options...
Kiroge Posted October 29, 2015 Author Share Posted October 29, 2015 you can call it anything you like, but it may help to make the filename represent what it does - e.g., supportsidebar.php Thanks I figured that out. It is all good now and many thanks again! 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.