dosrox Posted March 4, 2019 Share Posted March 4, 2019 Hi, I've looked all over the forums and came across alot of hooks to remove certain menu items and they worked just fine. However, i want to remove my store drop down menu entirely. Is there someone that can help me with the hook? I've tried this so far: add_hook('ClientAreaNavbars', -1, function () { $primaryNavbar = Menu::primaryNavbar(); $secondaryNavbar = Menu::secondaryNavbar(); //remove child from primary navbar if ($primaryNavbar && !is_null($primaryNavbar->getChild('Store.php'))) { $primaryNavbar->removeChild('Store.php'); } Thanks in advance. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 5, 2019 Share Posted March 5, 2019 22 hours ago, dosrox said: However, i want to remove my store drop down menu entirely. Is there someone that can help me with the hook? you can use the following hook to remove the Store menu dropdown... <?php # Remove Store From Navbar Hook # Written by brian! use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Store'))) { $primaryNavbar->removeChild('Store'); } }); 2 Quote Link to comment Share on other sites More sharing options...
dosrox Posted March 6, 2019 Author Share Posted March 6, 2019 Thanks Brian, I did this before however, i think it was a cookie related error on chrome. Sorry! 0 Quote Link to comment Share on other sites More sharing options...
dosrox Posted March 7, 2019 Author Share Posted March 7, 2019 Is there a way i can hide the dropdown menu's created on the nav bar when you're logged in? I basically want to use the navigation menu for logged out users and logged in users to be the same. Thanks in advance! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 8, 2019 Share Posted March 8, 2019 On 07/03/2019 at 11:34, dosrox said: Is there a way i can hide the dropdown menu's created on the nav bar when you're logged in? just me in particular? lol On 07/03/2019 at 11:34, dosrox said: I basically want to use the navigation menu for logged out users and logged in users to be the same. are you saying that you want users when they're logged in to still see... and not...? if so, then you would need a primary navbar hook to delete those menus if the client is logged in, and then recreate the "loggedout" menu items... with an optional secondary navbar hook if you want to do something similar on the "Account" side of the menu. 1 Quote Link to comment Share on other sites More sharing options...
dosrox Posted March 8, 2019 Author Share Posted March 8, 2019 You're welcome anytime! haha Basically i made a custom menu bar with hooks: Home Updates Contact Domainnames Webhosting Support. When users log in it adds the dropdown menu's you posted above. I just want to remove these drop down menu's: Service's, Domains, Billing, and Support. Sorry for my lack of knowledge, very new to whmcs! Thanks for the help! 0 Quote Link to comment Share on other sites More sharing options...
dosrox Posted March 10, 2019 Author Share Posted March 10, 2019 If someone can help me make a hook for hiding these dropdown menu's: Service's, Domains, Billing and support that would really help me out! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 10, 2019 Share Posted March 10, 2019 On 08/03/2019 at 13:13, dosrox said: Basically i made a custom menu bar with hooks: Home Updates Contact Domainnames Webhosting Support. and you want the user to see this custom menu whether they're logged in or not? if so, post your hook code - no point in me reinventing the wheel when you've done half the work! 🙂 1 Quote Link to comment Share on other sites More sharing options...
dosrox Posted March 10, 2019 Author Share Posted March 10, 2019 Right now when your not logged in users see this: https://gyazo.com/8357cd854222fb547973b57cefaf6a6e when they are you see this: https://gyazo.com/9f96365771a7c78c8a7f015abccaa138 From the second screenshot i want to remove the dropdown menu's ( Service's, Domains, Billing and support ) I have made this menu with several hooks you posted on the forums before. If possible, i'll make a new hook to remove these items for the logged in menu thats all i need. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 11, 2019 Share Posted March 11, 2019 20 hours ago, dosrox said: I have made this menu with several hooks you posted on the forums before. that's the bit I was afraid of - multiple hooks all interacting with the menu at the same time... and is why I asked you to post the hook code that you had used because while it's simple for me to post the code that would remove these menus, i'm reluctant to do it for fear of causing issues down the road (e.g one hook adding menus, another hook removing them and me not knowing the order that they're running)... but to remove those 4 items from the menu, you should just need to use the hook below... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { $client = Menu::context('client'); if (!is_null($client) && !is_null($primaryNavbar->getChild('Services'))) { $primaryNavbar->removeChild('Services'); } if (!is_null($client) && !is_null($primaryNavbar->getChild('Domains'))) { $primaryNavbar->removeChild('Domains'); } if (!is_null($client) && !is_null($primaryNavbar->getChild('Billing'))) { $primaryNavbar->removeChild('Billing'); } if (!is_null($client) && !is_null($primaryNavbar->getChild('Support'))) { $primaryNavbar->removeChild('Support'); } }); there are neater ways to do it, but i've tried to keep it simple to avoid issues - at some point, you really should consolidate those hooks that are modifying the navbar into just one hook. 1 Quote Link to comment Share on other sites More sharing options...
dosrox Posted March 12, 2019 Author Share Posted March 12, 2019 Ah, i'm sorry i have alot of "small" hooks so i thought i wouldn't soam you with all the code. Hooks are new to me as i said and i'll try yours right now i think this is exactly what i need! Thanks for the help so far brian, apparently my posts have to be approved first so sorry for the spam! 0 Quote Link to comment Share on other sites More sharing options...
dosrox Posted March 12, 2019 Author Share Posted March 12, 2019 Works like a charm, thank you!! 0 Quote Link to comment Share on other sites More sharing options...
Phill Posted September 22, 2020 Share Posted September 22, 2020 Hi! I have a same question here, but I don't want use the whmcs store, I want to use my Wordpress site when the plans are listed and linked to addtocart on whmcs. Ive changed the menu from navbar with hooks, but I have another buttons that show the cart with the plans from WHMCS Template (that are ugly), so I can't find a solution that show the cart with itens /cart.php?a=view - but I don't want show /cart.php plans, the same for categories... 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 23, 2020 Share Posted September 23, 2020 10 hours ago, Phill said: Hi! I have a same question here, but I don't want use the whmcs store, I want to use my Wordpress site when the plans are listed and linked to addtocart on whmcs. there are options - including not letting users see the front page of the cart (the one where you can choose products and/or product groups) by redirecting them elsewhere... 10 hours ago, Phill said: Ive changed the menu from navbar with hooks, but I have another buttons that show the cart with the plans from WHMCS Template (that are ugly), so I can't find a solution that show the cart with itens /cart.php?a=view - but I don't want show /cart.php plans, the same for categories... I might need to see what you're seeing - it sounds as though you're describing sidebars and if so, they too can be hidden with a hook - either individually or removing them all and adjusting the cart width... 0 Quote Link to comment Share on other sites More sharing options...
Henri Posted October 15, 2021 Share Posted October 15, 2021 Hi Guys, please excuse, I am new here. I would also like to remove the store option from the menu in my client area. A contributor offered the code below, that I would like to try. What file do I modify to include this code? <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { $client = Menu::context('client'); if (!is_null($client) && !is_null($primaryNavbar->getChild('Services'))) { $primaryNavbar->removeChild('Services'); } if (!is_null($client) && !is_null($primaryNavbar->getChild('Domains'))) { $primaryNavbar->removeChild('Domains'); } if (!is_null($client) && !is_null($primaryNavbar->getChild('Billing'))) { $primaryNavbar->removeChild('Billing'); } if (!is_null($client) && !is_null($primaryNavbar->getChild('Support'))) { $primaryNavbar->removeChild('Support'); } }); 0 Quote Link to comment Share on other sites More sharing options...
Jason22 Posted April 18, 2022 Share Posted April 18, 2022 On 3/5/2019 at 8:05 AM, brian! said: you can use the following hook to remove the Store menu dropdown... <?php # Remove Store From Navbar Hook # Written by brian! use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Store'))) { $primaryNavbar->removeChild('Store'); } }); Where do i post this code? 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted April 20, 2022 Share Posted April 20, 2022 On 4/19/2022 at 1:51 AM, Jason22 said: Where do i post this code? /includes/hooks/ 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.