tiagocaus Posted July 6, 2019 Share Posted July 6, 2019 Can you help me create the hooks to hide this part of the menu? Portal Home / Client Area / My Products & Services / Product Details This part of the menu should only be hidden if the product is = "Plano Site para Igreja" I'm not sure how to create it, I've never done it before. 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Developer WHMCS Nathan Posted July 10, 2019 WHMCS Developer Share Posted July 10, 2019 There are a number of ways that you could achieve this. One of the ways this could be accomplished is with the ClientAreaProductDetails and ClientAreaPrimarySidebar hook points. You would be using the ClientAreaProductDetails hook point to get the Package ID, and then nest the ClientAreaPrimarySidebar hook point inside that to modify the sidebar. Information about these two hook points can be found at the following URLs: https://developers.whmcs.com/hooks-reference/client-area-interface/#clientareaproductdetailshttps://developers.whmcs.com/hooks-reference/client-area-interface/#clientareaprimarysidebar The ClientAreaProductDetails hook point returns the Service class which you can read more about at https://docs.whmcs.com/classes/7.1/WHMCS/Service/Service.html I have taken a moment to put together a basic example of such a hook. You can review this below: <?php $data['packages'] = array('1'); // Array of Package IDs to be affected $data['children'] = array('Login to cPanel', 'Login to Webmail', 'Change Password'); // Array of Children to be removed add_hook('ClientAreaProductDetails', 1, function ($vars) use ($data) { $packageId = $vars['service']->packageId; if (in_array($packageId, $data['packages'])) { add_hook('ClientAreaPrimarySidebar', 1, function ($primarySidebar) use ($data) { $targetSidebar = $primarySidebar->getChild('Service Details Actions'); if ($targetSidebar) { foreach ($data['children'] as $child) { $targetSidebar->removeChild($child); } } }); } }); 2 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.