MarkVDD Posted December 1, 2020 Share Posted December 1, 2020 Hey all! Just a sidenote, I just started getting into WHMCS and know little to nothing about it, just following the docs and seeing what I can do. I am trying to remove the divider in the default navbar when you click on "Account" in between Login and Forgot Password? The code I am using is located in the /includes/hooks folder (named removeDivider.php if it is of any use) and is as follows: <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondaryNavbar', 1, function (MenuItem $secondaryNavbar) { if (!is_null($secondaryNavbar->getChild('Account'))) { $secondaryNavbar->getChild('Account')->removeChild('Divider'); } }); Now when I look at the frontend again I see no change, I tried add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { too, but without success, and I am starting to wonder if the hook is firing at all? Am I maybe using the wrong hook? Any help is greatly appreciated 🙂 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted December 2, 2020 Share Posted December 2, 2020 17 hours ago, Hosternate said: Just a sidenote, I just started getting into WHMCS and know little to nothing about it, just following the docs and seeing what I can do. that assumes that the example hooks posted in the docs actually work under all conditions... some don't and never have. there will be better examples of working navbar hooks posted in these forums over the last few years. 17 hours ago, Hosternate said: The code I am using is located in the /includes/hooks folder (named removeDivider.php if it is of any use) and is as follows: your first hook as written works for me.... as a sidenote, if the user was logged in, your hook would also remove the divider above Logout (red arrow) - you may or may not want that.... if you wanted to keep that logged in divider, the hook would need to determine if the client was logged in or not before removing the divider child. 17 hours ago, Hosternate said: I tried add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { too, but without success, and I am starting to wonder if the hook is firing at all? well that definitely wouldn't work as the primary navbar is the one on the left hand side; secondary is on the right. sometimes depending on the browser, you have to use shift+refresh (or equivalent) to see visible hook changes.... or you may need to clear the template cache.... or you might be using Cloudflare or similar and your still seeing the old cached version. 0 Quote Link to comment Share on other sites More sharing options...
MarkVDD Posted December 2, 2020 Author Share Posted December 2, 2020 6 hours ago, brian! said: that assumes that the example hooks posted in the docs actually work under all conditions... some don't and never have. there will be better examples of working navbar hooks posted in these forums over the last few years. your first hook as written works for me.... as a sidenote, if the user was logged in, your hook would also remove the divider above Logout (red arrow) - you may or may not want that.... if you wanted to keep that logged in divider, the hook would need to determine if the client was logged in or not before removing the divider child. well that definitely wouldn't work as the primary navbar is the one on the left hand side; secondary is on the right. sometimes depending on the browser, you have to use shift+refresh (or equivalent) to see visible hook changes.... or you may need to clear the template cache.... or you might be using Cloudflare or similar and your still seeing the old cached version. Ah, I see what I have done wrong. I made the folder in my child theme, so child_theme/includes/hooks/ But it needs to be in the root/includes/hooks. Thanks for making me double check 😛 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.