Bashy Posted October 19, 2016 Share Posted October 19, 2016 Hi, i have read all about the hooks etc and read a few posts on here, but what i cannot figure out is what file i actually edit to change the link to the Knowledgebase link in the navbar menu, i want it to point somewhere else.... 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 19, 2016 Share Posted October 19, 2016 there is no file to edit to change a link in the navbar - well I suppose technically you could edit navbar.tpl if you knew what you were doing, but there's no point. what you need to do is create a new .php file in /includes/hooks, call it kblinks.php (or whatever), and then paste the following code into it. <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Knowledgebase'))) { $primaryNavbar->getChild('Knowledgebase') ->setURI('https://www.google.com'); } if (!is_null($primaryNavbar->getChild('Support'))) { $primaryNavbar->getChild('Support') ->getChild('Knowledgebase') ->setURI('https://www.google.com'); } }); the first half is for the navbar kb link when the client is NOT logged in; the second half is for when they are. 1 Quote Link to comment Share on other sites More sharing options...
Bashy Posted October 19, 2016 Author Share Posted October 19, 2016 Hi Brian, thank you ever so much, that worked great could i please trouble you for the same in the left sidebar (logged in) shouldnt need to ask again (hopefully) as i will then have something to work with if needed in the future Thanks again, i really appreciate it 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 19, 2016 Share Posted October 19, 2016 use the following code instead in the same file... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Knowledgebase'))) { $primaryNavbar->getChild('Knowledgebase') ->setURI('https://www.google.com'); } if (!is_null($primaryNavbar->getChild('Support'))) { $primaryNavbar->getChild('Support') ->getChild('Knowledgebase') ->setURI('https://www.google.com'); } }); add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar) { if (!is_null($secondarySidebar->getChild('Support'))) { $secondarySidebar->getChild('Support') ->getChild('Knowledgebase') ->setURI('https://www.google.com'); } }); 0 Quote Link to comment Share on other sites More sharing options...
Bashy Posted October 19, 2016 Author Share Posted October 19, 2016 That works a treat, thank you once a again, should give me something to work with now, Chees Brian 0 Quote Link to comment Share on other sites More sharing options...
monovm Posted October 20, 2016 Share Posted October 20, 2016 Dear bashy why you do not use htaccess redirect ? you can redirect Knowledgebase url to any where you need. Regards 0 Quote Link to comment Share on other sites More sharing options...
Bashy Posted October 21, 2016 Author Share Posted October 21, 2016 Hi, sounds interesting, could you please explain, i did try using this example but it failed Redirect /path/to/old/file/old.html http://www.example.com/new/file/new.html 0 Quote Link to comment Share on other sites More sharing options...
Bashy Posted October 21, 2016 Author Share Posted October 21, 2016 Thanks Monovm, didnt realise there was an easier way 0 Quote Link to comment Share on other sites More sharing options...
hoya8 Posted January 14, 2021 Share Posted January 14, 2021 On 10/19/2016 at 5:19 PM, brian! said: there is no file to edit to change a link in the navbar - well I suppose technically you could edit navbar.tpl if you knew what you were doing, but there's no point. what you need to do is create a new .php file in /includes/hooks, call it kblinks.php (or whatever), and then paste the following code into it. <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Knowledgebase'))) { $primaryNavbar->getChild('Knowledgebase') ->setURI('https://www.google.com'); } if (!is_null($primaryNavbar->getChild('Support'))) { $primaryNavbar->getChild('Support') ->getChild('Knowledgebase') ->setURI('https://www.google.com'); } }); the first half is for the navbar kb link when the client is NOT logged in; the second half is for when they are. Hi Brian thanks again 🙂 is there any method to let this new url opened in the new browser windows/tab? like target=_blank ? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 18, 2021 Share Posted January 18, 2021 On 14/01/2021 at 16:41, hoya8 said: is there any method to let this new url opened in the new browser windows/tab? like target=_blank ? ->setAttribute("target", '_blank'); 0 Quote Link to comment Share on other sites More sharing options...
booksz Posted October 27, 2021 Share Posted October 27, 2021 Can i do this but for my Network Status ? 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.