tsupan Posted May 8, 2017 Share Posted May 8, 2017 I created the below to add "Our Services" to the primary menu. Question: how do i hide this menu item when user is logged in ? <?php add_hook('ClientAreaNavbars', 1, function () { // Get the current navigation bars. $primaryNavbar = Menu::primaryNavbar(); { // Save the "Contact Us" link and remove it from the primary navigation bar. $Start = $primaryNavbar->addChild('Our Services'); // Add the begin here link to the link's drop-down menu. $Start->addChild('begin-here', array( 'label' => 'Website Design', 'uri' => 'http://www.pumpitsolution.com/website-design', 'order' => 1, 'icon' => 'fa-pencil', )); // Add the overview link to the link's drop-down menu. $Start->addChild('overview', array( 'label' => 'Hosting', 'uri' => 'http://www.pumpitsolution.com/hosting/', 'order' => 2, 'icon' => 'fa-server', )); // Add the about us link to the link's drop-down menu. $Start->addChild('about-us', array( 'label' => 'Domain Name', 'uri' => 'http://awesome.pumpitsolution.com/cart.php?a=add&domain=register', 'order' => 3, 'icon' => 'fa-globe', )); // Add the link and its drop-down children to the secondary navigation bar. //$secondaryNavbar->addChild($Start); // Make sure the contact us link appears as the first item in the // secondary navigation bar. $Start->moveToBack(); }}); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 8, 2017 Share Posted May 8, 2017 I would suggest using this hook... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function(MenuItem $primaryNavbar) { $client = Menu::context('client'); if (is_null($client)) { $primaryNavbar->addChild('Our Services') ->setOrder('100'); $primaryNavbar->getChild('Our Services') ->addChild('begin-here', array( 'label' => 'Website Design', 'uri' => 'http://www.pumpitsolution.com/website-design', 'order' => 1, 'icon' => 'fa-pencil', )); $primaryNavbar->getChild('Our Services') ->addChild('overview', array( 'label' => 'Hosting', 'uri' => 'http://www.pumpitsolution.com/hosting/', 'order' => 2, 'icon' => 'fa-server', )); $primaryNavbar->getChild('Our Services') ->addChild('about-us', array( 'label' => 'Domain Name', 'uri' => 'http://awesome.pumpitsolution.com/cart.php?a=add&domain=register', 'order' => 3, 'icon' => 'fa-globe',)); } }); btw, it's worth mentioning that v7.2 will have a navbar menu item for non logged-in clients that works in a similar way - e.g it shows all product groups, domain registration and domain transfer... 0 Quote Link to comment Share on other sites More sharing options...
tsupan Posted May 8, 2017 Author Share Posted May 8, 2017 (edited) Thanks brian! it works. Good to know v7.2 has this feature.. i need a way to direct visitors to my store. When will this version be released? Edited May 8, 2017 by tsupan 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 8, 2017 Share Posted May 8, 2017 When will this version be released? it reached RC1 stage last Friday, so barring any major issues, I would expect the full release to be sometime this month - but only WHMCS will know exactly when, so keep an eye on the Announcements forum for specific news. 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.