Infused-Hosting Posted September 30, 2020 Share Posted September 30, 2020 Hi, I am trying to remove / edit the navbar items on our WHMCS installation. So far when not logged in, I've used a hook to redirect store menu links to the appropriate page on our main website. I'm now trying to edit the navbar once signed in by either A) Redirect "Order new services" to the main website OR B) Remove "Order new servers" completely from the dropdown. Reason being, I don't want customers being able to access the cart.php file unless processing an order. I've already enabled the redirect home to login page to reduce the chance of accessing the order cart manually. Our navbar also shows "Chat Now" but we dont have the live chat function installed. I tried the following hook in a new file but doesnt seem to work <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Chat Now'))) { $primaryNavbar->removeChild('Chat Now'); } }); Thanks Alec 0 Quote Link to comment Share on other sites More sharing options...
Infused-Hosting Posted September 30, 2020 Author Share Posted September 30, 2020 Actually fixed this now. I had missed one of the titles off the redirect hook for Order New Services. This now works. There was also a livehelp.php hook adding the chat now navbar item, once removed this is now gone. Thanks 0 Quote Link to comment Share on other sites More sharing options...
Infused-Hosting Posted September 30, 2020 Author Share Posted September 30, 2020 Edit sorry I am using the following hook to redirect store menu items to various pages. It was working but now has randomly stopped working. This is the code: <?php # Change Store Navbar Links Hook # Written by brian! use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function(MenuItem $primaryNavbar) { $Store = $primaryNavbar->getChild("Store"); if (empty($Store)) { return; } $StoreChildren = $Store->getChildren(); $kidslinks = array("Website Hosting", "Reseller Hosting", "Virtual Servers", "Dedicated Servers", "VPN",); foreach($StoreChildren as $key => $Store_details_child) { if (in_array($key, $kidslinks)) { if ($key === "Website Hosting"){$newlink = "https://infusedhosting.co.uk/website-hosting/";} elseif ($key === "Reseller Hosting"){$newlink = "https://infusedhosting.co.uk/reseller-hosting/";} elseif ($key === "Virtual Servers"){$newlink = "https://infusedhosting.co.uk/virtual-servers/";} elseif ($key === "Dedicated Servers"){$newlink = "https://infusedhosting.co.uk/dedicated-servers/";} elseif ($key === "VPN"){$newlink = "https://infusedhosting.co.uk/vpn/";} } } }); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 1, 2020 Share Posted October 1, 2020 22 hours ago, Infused-Hosting said: Edit sorry I am using the following hook to redirect store menu items to various pages. It was working but now has randomly stopped working. I think the clue is the big space with no code after the last elseif - take a look at the original hook in the thread below... you're basically missing the line that changes the link. 0 Quote Link to comment Share on other sites More sharing options...
Infused-Hosting Posted October 1, 2020 Author Share Posted October 1, 2020 2 minutes ago, brian! said: I think the clue is the big space with no code after the last elseif - take a look at the original hook in the thread below... you're basically missing the line that changes the link. Good spot. I thought something was missing but never checked the original. Thank you 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.