cluster Posted October 19, 2015 Share Posted October 19, 2015 Is this also working with Top menu? and how can I hide f.ex. the domain register from sidemenu? <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { if (!is_null($primarySidebar->getChild('Domains'))) { $primarySidebar->getChild('Domains') ->removeChild('Register a New Domain'); } }); 0 Quote Link to comment Share on other sites More sharing options...
cluster Posted October 19, 2015 Author Share Posted October 19, 2015 solved - the sidebar or topbar name is important ... - ClientAreaPrimaryNavbar - ClientAreaPrimarySidebar - ClientAreaSecondarySidebar <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $primarySidebar) { if (!is_null($primarySidebar->getChild('Client Shortcuts'))) { $primarySidebar->getChild('Client Shortcuts') ->removeChild('Order New Services'); } }); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 19, 2015 Share Posted October 19, 2015 if you are in the client area homepage and wanted to remove both the navbar link to register a domain, and the equivalent sidebar link, you could use the following code... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Domains'))) { $primaryNavbar->getChild('Domains') ->removeChild('Register a New Domain'); } }); add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar) { if (!is_null($secondarySidebar->getChild('Client Shortcuts'))) { $secondarySidebar->getChild('Client Shortcuts') ->removeChild('Register New Domain'); } }); I don't think in this instance you need to check that the client is logged in, but it would be simple enough to add if you ran into issues with it. also, you'll need to work through the client area because there are additional sidebar links to register a domain that you'll need to add more hooks to remove. the Cheatsheets in the v6 documentation - http://docs.whmcs.com/Version_6.0 - will be useful in guiding you through, but some of their code isn't quite right... so if you can find an example of what you want to do here in the forum, with code posted by myself or sentq (we've both posted numerous nav/sidebar hooks), trust that rather than the documentation code! 0 Quote Link to comment Share on other sites More sharing options...
cluster Posted October 19, 2015 Author Share Posted October 19, 2015 thanks is there also a hook possible for the client area home > domain check box? I need to hide the complete box ... Register a New Domain 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 19, 2015 Share Posted October 19, 2015 if you want to get rid of the whole sidebar (parent) and not a child, use the following... add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar) { if (!is_null($secondarySidebar->getChild('Client Shortcuts'))) { $secondarySidebar->removeChild('Client Shortcuts'); } }); 0 Quote Link to comment Share on other sites More sharing options...
cluster Posted October 19, 2015 Author Share Posted October 19, 2015 sorry, I meant the domain search box on client area home (clientareahome.tpl) 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 19, 2015 Share Posted October 19, 2015 sorry, I meant the domain search box on client area home (clientareahome.tpl) a screenshot is always useful to make sure we're talking about the same thing... if you mean the green homepage panel box, the following hook will remove it.. <?php use WHMCS\View\Menu\Item; add_hook('ClientAreaHomepagePanels', 1, function (Item $homePagePanels) { $homePagePanels->removeChild('Register a New Domain'); }); 1 Quote Link to comment Share on other sites More sharing options...
cluster Posted October 19, 2015 Author Share Posted October 19, 2015 thank you, I know I'm very stressful but now it is almost done ... you have helped me a lot! 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.