Jump to content

menu link Knowledgebase to point elsewhee


Bashy

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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');
   }
});

Link to comment
Share on other sites

  • 4 years later...
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  ?

 

Link to comment
Share on other sites

  • 9 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated