Jump to content

Alter Client Area Menu Navigation


jds

Recommended Posts

 

Hi, I'm trying to display the website & Security dropdown as seen in client area image uploaded. I would like this dropdown to be present when the client is not logged in as well, so removing the SSL Cert. Web security and VPN from the Store menu and moving to its own dropdown.  Any help would be highly appreciated  on creating the required hook to implement 

893592596_Screenshot2022-03-08at05_31_38.png.6b19803d90746440987c8a9149b79c23.png

Link to comment
Share on other sites

  • 2 weeks later...

For anyone that wanted this in the navbar to none-logged in users here's the code I managed to do myself - 

 

Quote

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
    $client = Menu::context('client');

if (is_null($client) && !is_null($primaryNavbar->addChild('Website & Security'))) {
        $primaryNavbar->addChild('Website & Security')
        ->setUri('#')
        ->setOrder(30);
    }
    
   if (!is_null($primaryNavbar->getChild('Store'))) {
            $primaryNavbar->getChild('Store')
            ->removeChild('sitelock')
            ->removeChild('sitelockvpn')
            ->removeChild('symantec');
    }
    
    if (is_null($client) && !is_null($primaryNavbar->getChild('Website & Security'))) 
    
    {
            $primaryNavbar->getChild('Website & Security')
                ->addChild('sitelock', array(
                'label' => Lang::trans('Website Security'),
                'uri' => 'store/sitelock',
                'order'    => 10,));
                
            $primaryNavbar->getChild('Website & Security')    
                ->addChild('symantec', array(
                'label' => Lang::trans('SSL Certificates'),
                'uri' => 'store/ssl-certificates',
                'order'    => 20,));
                
            $primaryNavbar->getChild('Website & Security')    
                ->addChild('sitelockvpn', array(
                'label' => Lang::trans('VPN'),
                'uri' => 'store/vpn',
                'order'    => 30,));
    }

});

 

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.

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