Jump to content

Make navbar parent visible only after login


Recommended Posts

Hi folks :)


The below script adds a navbar drop-down menu pre-login and disappears after login, but does anyone know how to make it do the opposite? I would like to hide a parent pre-login and make it visible post-login.


I found it on an earlier thread and thought it was very useful :)





use WHMCS\View\Menu\Item as MenuItem;


add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)


$client = Menu::context('client');


// only add menu item when no client logged in


if (is_null($client)) {

$primaryNavbar->addChild('Client Portals')


$primaryNavbar->getChild('Client Portals')

->addChild('Remote Support', array(

'label' => 'Remote Support',

'uri' => 'http://www.example.com',

'order' => '200',


$primaryNavbar->getChild('Client Portals')

->addChild('Divider1', array(

'order' => '300',



$primaryNavbar->getChild('Client Portals')

->addChild('WebMail', array(

'label' => 'WebMail',

'uri' => 'http://webmail.example.com',

'order' => '400',


$primaryNavbar->getChild('Client Portals')

->addChild('Divider2', array(

'order' => '500',



$primaryNavbar->getChild('Client Portals')

->addChild('WebStats', array(

'label' => 'WebStats',

'uri' => 'http://example.com',

'order' => '600',




Link to comment
Share on other sites

I bought an awesome module last night which let me fly through many navbar options. It's very affordable and is called WHMCS Advanced Menu Manager. I had been banging my head looking for answers all yesterday but within minutes of installing I was all over it like white on rice, haha.


Here's my recent thread with screenshots https://forum.whmcs.com/showthread.php?128534-Hide-Announcements-Knowledgebase-RSS-etc


I'm new to PHP and find it fascinating but sometimes I just need to crack on with my day and move to the next part of the project.


Good luck :)

Link to comment
Share on other sites

Join the conversation

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

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