Jump to content

Cannot remove some items on a sidebar ... 2e hours spent Anyone can help please?


Recommended Posts

Hello,

 

[ATTACH=CONFIG]14202[/ATTACH]

 

Those 2 items (downloads and network status) I did not manage to remove them

All my attempts ends up with the site not working. I used the hooks doc.

 

I spent a lot of time trying all the codes I have seen in the doc. But nothing.

 

Can someone tell me how to do it please?

 

Thank you in advance.

 

- - - Updated - - -

 

attachment does not seem to work

 

https://i.imgur.com/EUFfqpQ.png

 

EUFfqpQ.png

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Can I ask one more thing (i am sorry to ask something else)

How to remove Contact (Add New contact) that:

https://i.imgur.com/K40CBth.png

not a problem...

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar)
{
   if (!is_null($secondarySidebar->getChild('Client Contacts'))) {
               $secondarySidebar->removeChild('Client Contacts');
   }
});

or if you want to combine them together in one file (so that you don't have too many separate hook files)...

 

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

   if (!is_null($secondarySidebar->getChild('Client Contacts'))) {
               $secondarySidebar->removeChild('Client Contacts');
   }
});

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