imes Posted October 11, 2017 Share Posted October 11, 2017 Greetings, I've been trying to create hooks to remove menu item using hooks, just like listed here : https://developers.whmcs.com/hooks-reference/client-area-interface/#clientareanavbars However, it didn't seemed like the hook even got triggered at all (none listed in activity log on my whmcs too), no error thrown on my php error log or apache error log.) I'm using whmcs version 7.2. Here is my code, i put it on mywhmcs/includes/hooks/ <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaNavbars', 1, function () { file_put_contents('../debug.txt', 'test text'); // Get the current navigation bars. $primaryNavbar = Menu::primaryNavbar(); $secondaryNavbar = Menu::secondaryNavbar(); $children = $primaryNavbar->getChildren(); if (!is_null($children)) { foreach ($children as $child) { $primaryNavbar->removeChild($child); } } $children = $secondaryNavbar->getChildren(); if (!is_null($children)) { foreach ($children as $child) { $secondaryNavbar->removeChild($child); } } }); ?> Any clues? Am i doing something wrong? Any lead/help will be greatly appreciated 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Developer WHMCS Andrew Posted October 11, 2017 WHMCS Developer Share Posted October 11, 2017 I suggest using logActivity("Message here") in place of the file put contents... it's more reliable. For the removing, please see https://docs.whmcs.com/Client_Area_Navigation_Menus_Cheatsheet which has an example for you to use which you can build on. 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.