Jump to content

Hiding/Removing a Sidebar Menu Items WHMCS 6.1


Kiroge

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.
Link to comment
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

Link to comment
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

Link to comment
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?

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