Jump to content
Kiroge

Hiding/Removing a Sidebar Menu Items WHMCS 6.1

Recommended Posts

Hi guys,

 

I succeeded to hide some menus most of primary menus using hooks by followed instruction provided on '

Client Area Navigation Menus Cheatsheet' section. However, I am stuck as I can't figure out how to hide other menu items on client area once she/he login on sidebar area. I would like to hide and be able to update later without loosing my changes.

 

Here below are the screenshots of menu items which I would like to hide.

 

dropbox.com/s/4c0w6z57urcfwze/menu1.png?dl=0

 

dropbox.com/s/keapl37poflti2g/menu2.png?dl=0

 

dropbox.com/s/9pl4vyooz4kubee/cart.png?dl=0

 

Help would be much appreciate. If you can provide me the codes and direction how and where to put it

 

Thanks!

Edited by Infopro
Please Attach Images to Your Posts.

Share this post


Link to post
Share on other sites
Hi guys,

 

I succeeded to hide some menus most of primary menus using hooks by followed instruction provided on '

Client Area Navigation Menus Cheatsheet' section. However, I am stuck as I can't figure out how to hide other menu items on client area once she/he login on sidebar area. I would like to hide and be able to update later without loosing my changes.

 

Here below are the screenshots of menu items which I would like to hide.

 

dropbox.com/s/4c0w6z57urcfwze/menu1.png?dl=0

 

dropbox.com/s/keapl37poflti2g/menu2.png?dl=0

 

dropbox.com/s/9pl4vyooz4kubee/cart.png?dl=0

 

Help would be much appreciate. If you can provide me the codes and direction how and where to put it

 

Thanks!

 

Please see attached screenshots for my problems below:

 

cart.png

menu2.png

menu1.png

Share this post


Link to post
Share on other sites

with regards to menu 1, if you wanted to remove the children for everyone (those links exist for both clients and non-clients), you could use the following...

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar)
{
   if (!is_null($secondarySidebar->getChild('Support'))) {
            $secondarySidebar->getChild('Support')
                           ->removeChild('Announcements')
                           ->removeChild('Knowledgebase')
                           ->removeChild('Downloads')
                           ->removeChild('Network Status')
                           ->removeChild('Open Ticket');
   }
});

if you wanted to only remove these links in the client area, but keep them elsewhere, you could use the following...

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar)
{
   $client = Menu::context('client');
   if (!is_null($client)) {
       if (!is_null($secondarySidebar->getChild('Support'))) {
               $secondarySidebar->getChild('Support')
                               ->removeChild('Announcements')
                               ->removeChild('Knowledgebase')
                               ->removeChild('Downloads')
                               ->removeChild('Network Status')
                               ->removeChild('Open Ticket');
       }
   }
});

for menu 2, it's similar to the above - just go through the view source of the page to find the names of the menuitemname you want to remove and add them to a hook.

 

for 3, that's a template edit - take a look at the <!-- Shopping Cart --> section of six/header.tpl

Share this post


Link to post
Share on other sites
with regards to menu 1, if you wanted to remove the children for everyone (those links exist for both clients and non-clients), you could use the following...

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar)
{
   if (!is_null($secondarySidebar->getChild('Support'))) {
            $secondarySidebar->getChild('Support')
                           ->removeChild('Announcements')
                           ->removeChild('Knowledgebase')
                           ->removeChild('Downloads')
                           ->removeChild('Network Status')
                           ->removeChild('Open Ticket');
   }
});

if you wanted to only remove these links in the client area, but keep them elsewhere, you could use the following...

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar)
{
   $client = Menu::context('client');
   if (!is_null($client)) {
       if (!is_null($secondarySidebar->getChild('Support'))) {
               $secondarySidebar->getChild('Support')
                               ->removeChild('Announcements')
                               ->removeChild('Knowledgebase')
                               ->removeChild('Downloads')
                               ->removeChild('Network Status')
                               ->removeChild('Open Ticket');
       }
   }
});

for menu 2, it's similar to the above - just go through the view source of the page to find the names of the menuitemname you want to remove and add them to a hook.

 

for 3, that's a template edit - take a look at the <!-- Shopping Cart --> section of six/header.tpl

 

Thank you very much Brian! So which file .php name should I use to save into hooks folder?

Share this post


Link to post
Share on other sites

Hi Brian,

 

Thank you very much your codes and instruction help me to hide menu items & shopping cart. I really appreciate your help!:!:

Share this post


Link to post
Share on other sites
Thank you very much Brian! So which file .php name should I use to save into hooks folder?

you can call it anything you like, but it may help to make the filename represent what it does - e.g., supportsidebar.php

Share this post


Link to post
Share on other sites
you can call it anything you like, but it may help to make the filename represent what it does - e.g., supportsidebar.php

 

Thanks I figured that out. It is all good now and many thanks again!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines