Jump to content

How can I add an additional menu to the navigation bar


Frozen233

Recommended Posts

Hello

 

I've asked WHMCS Support how to add an additional menu item / button in the top navbar which has to show when people are logged in.... I had this in 5.xx and was quite easy to do however I can't manage to do it now.

 

They told me I can use this code, however I have no clue where I need to paste this code?? At which file?

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
   $primaryNavbar->getChild('Support')
       ->addChild('Emergency Contacts', array(
           'label' => 'Emergency Contacts',
           'uri' => 'emergency.php',
           'order' => '100',
       ));
});

 

Where am I supposed to paste that? Maybe I feel everything is too complicated but it's very easy at the end, did my best to find it out but can't understand it... Hope someone can help me

Link to comment
Share on other sites

You need turn it into a hook and upload to whmcsroot/includes/hooks.

 

<?php

$ca = new WHMCS_ClientArea();

use WHMCS\View\Menu\Item as MenuItem;



if ($ca->isLoggedIn()) {



add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
$primaryNavbar->addChild('Example')
->setUri('https://www.example.com')
->setOrder(70);
});

} 
add_hook("ClientAreaPrimaryNavbar");

?>

 

 

Just copy this and make a file called navbar.php ( or anything you like) and paste it in there then upload it will add new link on navbar but only when logged in.

Edited by lee-wservices
Link to comment
Share on other sites

I managed to do it. Many thanks!

 

Another thing, why does the IP: field nolonger appear in product details in the client area? In 5.xx the IP written in Dedicated IP: was viewable at product details when a customer watched its product, the IP is no longer showing. Can it be enabled somehow?

 

I tried having the product as type "Other " or "Dedicated/ VPS" and with none of them the IP Address is shown, only the icon changes...

 

Thanks

 

- - - Updated - - -

 

Indeed, just tested with the "Five"template and the IP Address appears at product details, but it does not appear at the "Six" template...

Link to comment
Share on other sites

  • 1 month 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