Jump to content

Remove Menu Items - v6


CCSupport

Recommended Posts

Hello all,

 

I would like to remove some of the menu items on the main Nav & sidebar within WHMCS v6.

 

After reading this page I am pretty confused as to how to simply remove the link/item altogether.

 

In essence, I need to remove Network Status from the 'Support' dropdown including the sidebar and also want to remove the 'Order Hosting' from the main homepage where it states "How can we help today?"

 

Any assistance or guidance to the right file(s) would be appreciated.

Link to comment
Share on other sites

Fantastic, thank you :-)

 

- - - Updated - - -

 

Just to check, as I have never added hooks before, do I need to name the .php file something specific or can it be anything as long as it is in the /hooks folder? I ask as I have just created a file named 'removenetwork.php' and added the remove network status example code but it did nothing....guessing I am missing something!

Link to comment
Share on other sites

I did some quick testing on my WHMCS installation and was able to get the following hook function working to remove the 'Network Status' submenu item from the 'Support' menu.

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) {
   if (!is_null($primaryNavbar->getChild('Support'))) {
       $primaryNavbar->getChild('Support')->removeChild('Network Status');
   }
});

 

I simply placed this inside the /includes/hooks directory in a file called remove_network_status.php

Link to comment
Share on other sites

want to remove the 'Order Hosting' from the main homepage where it states "How can we help today?"

this one will be a template edit - six/header.tpl - remove the following...

 

                        <li>
                           <a id="btnOrderHosting" href="cart.php">
                               <i class="fa fa-hdd-o"></i>
                               <p>
                                   {$LANG.orderhosting} <span>»</span>
                               </p>
                           </a>
                       </li>

Link to comment
Share on other sites

Many thanks for the help with this one.

 

I have managed, with the code above, to remove the Network Status on the top Nav bar, thank you!

 

I am having an issue with the sidebar though. This is what I thought would have worked but only breaks the site:

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar)
{
   $primarySidebar->getChild('Support')
       ->removeChild('Network Status');
});

 

- - - Updated - - -

 

Thanks Brian. I decided to just change the wording so it fits with what's on offer rather than hosting...thanks :-)

Link to comment
Share on other sites

I am having an issue with the sidebar though. This is what I thought would have worked but only breaks the site.

lots of the code examples in the v6 docs will do this. :roll:

 

the basic rule to follow is that you need to check if the menu/sidebar etc exists - and only if it does, can you modify it... if you try to modify something that doesn't exist, that's when you get a blank page...

 

http://forum.whmcs.com/showthread.php?104955-Using-hooks-to-change-sidebar-menus-works-on-some-pages-blank-screens-on-others&p=432506#post432506

Link to comment
Share on other sites

Thanks Brian. Nothing is working to get rid of what I wanted.

 

Very much confused as everything I am trying to remove the 'Network Status' under the 'Support' sidebar is failing. The Support Sidebar only shows under the Support>Tickets & Support>Downloads pages it seems. I have removed near enough everything else required so I will leave it be I think...it only takes to a page that says no issues so I think it'll have to do!

 

Thanks for your help :-)

Link to comment
Share on other sites

the sidebar @ Support>Tickets & Support>Downloads is a secondary sidebar and not a primary one - so you'd need to use the secondary sidebar hook...

 

<?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('Network Status');
   }
});

tested locally and works. :idea:

Link to comment
Share on other sites

I'm still getting issues with these menus! Arrgghhhh :roll:

 

I have changed the wording for 'Home' to 'Client Area Home' and I want to add another link that says 'Home' to link to the main website. I have looked at the adding of Primary menu items, however each time I add any code that I think would work it is breaking the site!

 

Is the issue because I am trying to use 'Home' for the name again?

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