Jump to content

Hide Announcements, Knowledgebase, RSS etc


Rigsby

Recommended Posts

Greetings :)

 

I would like to hide a few links from the navbar and sidebar. I can't quite seem to find the correct hook/s, and I've been searching everywhere.

 

I have managed to hide a few items under the Support dropdown (Announcements, Knowledgebase and Downloads), but it's the single links for Announcements and Knowledgebase in the navbar that I can't seem to crack, and I also have not yet found a solution for the sidebar.

 

Please can someone help?

 

Many thanks in advance :)

Link to comment
Share on other sites

Additionally, I am also trying to find a way to hide navbar links pre-login (I don't yet have a Knowledgebase; Home is redundant because that's the page that is loaded; Announcements I can use but only for logged in clients).

 

If anyone could help that would be great.

 

Thanks :)

Link to comment
Share on other sites

I have just spent the best £21 I will ever spend. It's a module for the navbar, and it.. is.. awesome! Search for WHMCS Advanced Menu Manager. The only downside, unless I haven't seen the option for it yet, is that it doesn't work with the sidebar. I wish I had known about this app 18 hours ago because I would be in bed instead of being up until 5am Zzzz

 

They should pay me commission :idea:

 

Tomorrow, I'm on the hunt for modules! What else is out there that are timesavers? Any ideas would be great :)

 

Screen Shot 2017-05-06 at 04.38.54.png

 

Screen Shot 2017-05-06 at 04.39.38.png

Link to comment
Share on other sites

one simple thing to remember is that removing navbar children and sidebar children is basically exactly the same process - you just use different specific hooks to do it.... and always check that the sidebar/navbar exists before trying to remove/modify it.

 

with regards to the navbar/sidebar, if you wanted to do both as one hook...

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

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

   if (!is_null($primaryNavbar->getChild('Announcements'))) {
       $primaryNavbar->removeChild('Announcements');
   }
}); 

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

Link to comment
Share on other sites

I have just spent the best £21 I will ever spend. It's a module for the navbar, and it.. is.. awesome! Search for WHMCS Advanced Menu Manager. The only downside, unless I haven't seen the option for it yet, is that it doesn't work with the sidebar. I wish I had known about this app 18 hours ago because I would be in bed instead of being up until 5am Zzzz

WHMCS should have done something similar when they introduced the feature in v6 - but they expect everyone to learn how to write hooks to modify menus... or pay someone to do it. :roll:

Link to comment
Share on other sites

  • 3 years later...

Hi, actually I made this hook, but the RSS Feed doesn't not dissapper.

Could you give me some advice what I'm doing wrong?

I don't know which hook is correct, but all of this do not remove View RSS Feed from Announcements.

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
   if (!is_null($primaryNavbar->getChild('Announcements'))) {
       $primaryNavbar->getChild('Announcements')
            ->removeChild('View RSS Feed');       
   }
}); 

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $secondarNavbar)
{
   if (!is_null($secondarNavbar->getChild('Announcements'))) {
       $secondarNavbar->getChild('Announcements')
            ->removeChild('View RSS Feed');       
   }
}); 

add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar)
{
   if (!is_null($primarySidebar->getChild('Announcements'))) {
       $primarySidebar->getChild('Announcements')
            ->removeChild('View RSS Feed');       
   }
});

add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar)
{
   if (!is_null($secondarySidebar->getChild('Announcements'))) {
       $secondarySidebar->getChild('Announcements')
            ->removeChild('View RSS Feed');       
   }
}); 

 

Link to comment
Share on other sites

  • 3 weeks 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