Jump to content

Hide from the main menu: Announcements and Server Status WHMCS 7.5.1


grpcom

Recommended Posts

Hello

I have been searching within WHMCS for the past few days, if there is any option within the main settings panel to disable 2 options that are within the WHMCS menu:

- Announcements
- Server status

Can someone please tell me how I can disable those menu options.

Thanks in advance!

Link to comment
Share on other sites

15 hours ago, grpcom said:

I have been searching within WHMCS for the past few days, if there is any option within the main settings panel to disable 2 options that are within the WHMCS menu:

there are no options to disable it from the admin side - the way to remove them would be to use action hooks...

so create a .php file in /includes/hooks/, call it anything you like (e.g navbar.php) and paste the code below into it...

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

ch2qpkk.png

this removes those two links for clients who are not logged in; when logged in, clients can see those two links in the navbar and also the sidebar - it's simple to remove these links too, and i've certainly posted other hooks here that can do that. :idea:

Link to comment
Share on other sites

  • 2 years later...
On 6/26/2018 at 2:53 PM, brian! said:

there are no options to disable it from the admin side - the way to remove them would be to use action hooks...

so create a .php file in /includes/hooks/, call it anything you like (e.g navbar.php) and paste the code below into it...


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

ch2qpkk.png

this removes those two links for clients who are not logged in; when logged in, clients can see those two links in the navbar and also the sidebar - it's simple to remove these links too, and i've certainly posted other hooks here that can do that. :idea:

Hi Brian

You are everywhere:)

could you share how to completely remove menu items even when clients logged in please

 

You are a star!

Link to comment
Share on other sites

On 12/01/2021 at 20:07, hoya8 said:

You are everywhere:)

I see all, I read all... I try my best not to feel obliged to answer all. 😎

On 12/01/2021 at 20:07, hoya8 said:

could you share how to completely remove menu items even when clients logged in please

you would only need to check logged in status if what you were removing was shown to both logged in and not logged in users....

generally, you just use $client = Menu::context('client'); and then check it's value to see whether the current user is logged in or not...

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