Jump to content

how to remove the two items on v6 ?


rob2

Recommended Posts

Hi,

 

i had check many post about use hook to hide or remove the items at sidebar,

 

but it seems those items are menus with hyperlink,

 

and what is need to remove are not menu(hyperlink),

 

for instance,the priirity at itcket and get epp code at domain,

 

do you know how to hide them ?

 

 

thank youticket.jpg

domain.png

Link to comment
Share on other sites

for removing the "Get EPP Code" child link, use the code I posted in the thread below...

 

http://forum.whmcs.com/showthread.php?90982-disable-client-get-epp-code&p=438838#post438838

 

for removing the "Priority" details from the sidebar, use...

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

   add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) 
       {
       if (!is_null($primarySidebar->getChild('Ticket Information'))) {
                       $primarySidebar->getChild('Ticket Information')
                                       ->removeChild('Priority');                
       }
});

Link to comment
Share on other sites

Hi,

 

may i ask a question,

 

one is " if (!is_null($primarySidebar->getChild('Domain Details Management'))) { " ,

 

and this one is " if (!is_null($primarySidebar->getChild('Ticket Information'))) { " ,

 

how do you know it is "Details Management" or "Information" ?

 

because i think try to remove the following 4 parts at support but no effect.

 

 

Announcements

Knowledgebase

Downloads

Network Status

 

 

thank you

Link to comment
Share on other sites

Hi Rob,

 

may i ask a question,

one is " if (!is_null($primarySidebar->getChild('Domain Details Management'))) { " ,

and this one is " if (!is_null($primarySidebar->getChild('Ticket Information'))) { " ,

how do you know it is "Details Management" or "Information" ?

because i think try to remove the following 4 parts at support but no effect.

Announcements

Knowledgebase

Downloads

Network Status

http://docs.whmcs.com/Client_Area_Navigation_Menus_Cheatsheet#Finding_a_Menu_Item_Name

 

Every menu item has a unique name that is used to reference it. You will need this name in order to manipulate it. To make it easier, we have made the name of each menu item available in the HTML source of the page, which means it can be retrieved using the Inspect Element option available in most modern browsers.

so what I would do is to view the source of the page in the browser and use that to find the menuitem names...

 

<li menuItemName="Support" class="dropdown" id="Primary_Navbar-Support">
       <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                       Support
                        <b class="caret"></b>        </a>
                   <ul class="dropdown-menu">
                           <li menuItemName="Tickets" id="Primary_Navbar-Support-Tickets">
                   <a href="supporttickets.php">
                                               Tickets
                                           </a>
               </li>
                           <li menuItemName="Announcements" id="Primary_Navbar-Support-Announcements">
                   <a href="announcements.php">
                                               Announcements
                                           </a>
               </li>
                           <li menuItemName="Knowledgebase" id="Primary_Navbar-Support-Knowledgebase">
                   <a href="knowledgebase.php">
                                               Knowledgebase
                                           </a>
               </li>
                           <li menuItemName="Downloads" id="Primary_Navbar-Support-Downloads">
                   <a href="downloads.php">
                                               Downloads
                                           </a>
               </li>
                           <li menuItemName="Network Status" id="Primary_Navbar-Support-Network_Status">
                   <a href="serverstatus.php">
                                               Network Status
                                           </a>

from the above code, I then know that it's a primary navbar and the names of the "Support" menuitem and all of its children.

 

if you wanted to remove the four items you mention, you would do this...

 

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

by default, this "Support" navbar item only exists when the client is logged in - therefore, you don't really need to check in the action hook if they're logged in or not... though there would be no harm in checking if they are logged in if you wanted to be sure. :idea:

Link to comment
Share on other sites

Hi Rob,

 

thanks for your explain and i understnad more,

but it seems the hook file has no effect to hide those items,

may you help me check it ?

the hook works fine - but I misread your question and thought you were asking about the navbar and not sidebars... my mistake. :roll:

 

to remove these items from a sidebar, the code is the same - you just you a different hook...

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

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

apologies for the confusion. :)

Link to comment
Share on other sites

  • 2 months later...

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