Persemp Posted November 17, 2017 Share Posted November 17, 2017 Dear community, I am new on this forum. Since a month I have been trying to configure the WHMCS installation for my needs. WHMCS hotline has directed me to this forum. Can someone from the community help me, who has already experienced with WHMCS ? I want to remove from the menu ,,Announcements,, and ,,Network Status,,. I found this code (below) to copy in a hook.The question: in which hook do I have to copy this code? Do I have to create a new hook? If so, with what name? Thank you for help. Best regards: Persemp Hiding/Removing a Menu Item You can remove a menu item as follows: <?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'); } }); Link to comment Share on other sites More sharing options...
sentq Posted November 18, 2017 Share Posted November 18, 2017 Welcome to the WHMCS community you need to create new .php file inside /includes/hooks/ directory, the file name could be anything, lets call it RemoveNavbarAnnouncementsStatus.php then copy the following lines inside it, it should remove both links from Primary Navbar: <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Announcements'))) { $primaryNavbar->removeChild('Announcements'); } if (!is_null($primaryNavbar->getChild('Network Status'))) { $primaryNavbar->removeChild('Network Status'); } }); 1 Link to comment Share on other sites More sharing options...
hosteroven Posted November 18, 2017 Share Posted November 18, 2017 1. Create a new php file in the /includes/hooks folder. You can name it whatever you want (e.g. remove_menu_items.php) 2. Copy and paste this code: <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Announcements'))) { $primaryNavbar->removeChild('Announcements'); } if (!is_null($primaryNavbar->getChild('Network Status'))) { $primaryNavbar->removeChild('Network Status'); } }); 3. Save and refresh your page. Link to comment Share on other sites More sharing options...
Persemp Posted November 19, 2017 Author Share Posted November 19, 2017 Hello Sentq and Hosteroven, Thank you, it works. I wish you much success with your projects. Best regards Persemp Link to comment Share on other sites More sharing options...
Recommended Posts