Jump to content

How i do remove the "knowledgebase" from the primary menu ?


tsupan

Recommended Posts

Hi I need help on how to remove the "knowledgebase" from the menu.

Can anyone tell me how do i do that ?

 

I tred the below in hooks/menu.php but doesnt work.

 

 

 

 

<?php

 

add_hook('ClientAreaNavbars', 1, function ()

 

 

{

 

 

 

Get the current navigation bars.

$primaryNavbar = Menu::primaryNavbar();

 

 

 

if (!is_null($primaryNavbar->getChild('Support')))

{ $primaryNavbar->getChild('Knowledgebase')

->removeChild('Knowledgebase');}

Link to comment
Share on other sites

that's close, but it should be...

 

<?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('Support'))) {
       $primaryNavbar->getChild('Support')
                       ->removeChild('Knowledgebase');
   }   
});

the first block removes the KB link for users not logged in... the second one removes it from the Support menu for those that are.

Link to comment
Share on other sites

  • 2 years later...
6 minutes ago, VirtualWorldGlobal said:

Can't we hide knowledgebase and announcements for users not logged in from Admin Area settings ?

do you think I would have written the hooks if we could. 🙂

you could hide knowledgebase articles for users not logged in by marking them private, but there is no similar option for announcements.

Link to comment
Share on other sites

25 minutes ago, VirtualWorldGlobal said:

I ticked and saved the knowledgebase articles as PRIVATE but they are still showing. any other settings I need to change ?

sounds like it's cacheing or you're already logged in as a client... marking an article as private should require you to login if you aren't already logged in.

2 minutes ago, VirtualWorldGlobal said:

With showing I mean that the KB Subject is visible but when we click on it to read that requires login

that sounds about right - out of the box, you can't make categories private, only their articles.

Edited by brian!
Link to comment
Share on other sites

Hi,

Thank you so much, this served my purpose

<?php

use WHMCS\View\Menu\Item as MenuItem;

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

 

I also want to hide announcements, what needs to be done ?

Link to comment
Share on other sites

8 minutes ago, VirtualWorldGlobal said:

I also want to hide announcements, what needs to be done ?

bear in mind that the above code simply removes the link in the navbar... if they know the URL of the main page, or even an non-private article, they could still go to that page if they want to.

to hide the announcements link, add the above after the if statement above...

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

remembering that you're just removing the links for non-logged in users - the kb/announcement links will still be there for users that are logged in.

and if you want to remove announcements from the homepage if using Six)...

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Hi guys, i need help, i removed allready the  links Knowledgebase and announcement.

do done the same with Network Status and it is not working.

i put every link in seperated file, so for three links to remove i have tree files menu1, menu2, menu3

I saved a copy of the working files and just changed the name.

 

also i want remove the dropdown menu " shop" and all items in There should be directly in navbar.

 

Please help me to resolve this problem.

 

 

 

Link to comment
Share on other sites

@CL IT Service Can you please try this at your end.

 

All Thanks to brian! 

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

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

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

 

 

Edited by VirtualWorldGlobal
Link to comment
Share on other sites

14 hours ago, CL IT Service said:

i put every link in seperated file, so for three links to remove i have tree files menu1, menu2, menu3

we would ideally need to see the hook codes used and your site because depending on if your site is using a custom theme, you may need to edit template files rather than hooks to remove certain menu links (e.g depends if it's a theme-based menu or a WHMCS navbar menu).

Link to comment
Share on other sites

i solved it allready to remove  knowledgebar etc.

 

but now i just need to add the childs of shop to primary navbar.

Domain register and domein transfer and hosting products.

i used the example from here to remove the links.

 

yes i use an costum template "Flowhost"

but for hooks i dont need to modify template here

 

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