TGK Posted July 24, 2018 Share Posted July 24, 2018 hi im trying hide a menu entry but i cant, i did saw somes guides like this https://developers.whmcs.com/themes/sidebars/ https://whmcs.community/topic/248457-hook-can-not-hide-menu-entry/?tab=comments#comment-1155521 but still i cant :( im just want remove the following Menu items in client Area : "Clients Contacts" and "Client Shortcuts" thanks for your help. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 25, 2018 Share Posted July 25, 2018 you should just need the following hook - create .php file in /includes/hooks (e.g clientsidebars.php), paste the code below into it and the sidebars should be gone the next time you refresh the page. <?php /** * Remove Contacts & Shortcuts Sidebars * @author brian! */ add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar) { if (!is_null($secondarySidebar->getChild('Client Contacts'))) { $secondarySidebar->removeChild('Client Contacts'); } if (!is_null($secondarySidebar->getChild('Client Shortcuts'))) { $secondarySidebar->removeChild('Client Shortcuts'); } }); 1 Quote Link to comment Share on other sites More sharing options...
TGK Posted July 25, 2018 Author Share Posted July 25, 2018 4 hours ago, brian! said: you should just need the following hook - create .php file in /includes/hooks, paste the code below into it and the sidebars should be gone the next time you refresh the page. <?php /** * Remove Contacts & Shortcuts Sidebars * @author brian! */ add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar) { if (!is_null($secondarySidebar->getChild('Client Contacts'))) { $secondarySidebar->removeChild('Client Contacts'); } if (!is_null($secondarySidebar->getChild('Client Shortcuts'))) { $secondarySidebar->removeChild('Client Shortcuts'); } }); thanks for help i did it but when i refresh page i get error mensaje " something is wrong" i leave a screenshot 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 26, 2018 Share Posted July 26, 2018 you will need to enable Display Errors (Mostra Errores) from the general settings -> other tab.. that should tell you where the error is. 0 Quote Link to comment Share on other sites More sharing options...
TGK Posted July 26, 2018 Author Share Posted July 26, 2018 thanks leave a screen shot for errores. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 27, 2018 Share Posted July 27, 2018 <?php /** * Remove Contacts & Shortcuts Sidebars * @author brian! */ 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'); } if (!is_null($secondarySidebar->getChild('Client Shortcuts'))) { $secondarySidebar->removeChild('Client Shortcuts'); } }); 2 Quote Link to comment Share on other sites More sharing options...
TGK Posted July 27, 2018 Author Share Posted July 27, 2018 thanks Brian thats works fine. ☺️ 0 Quote Link to comment Share on other sites More sharing options...
TGK Posted July 28, 2018 Author Share Posted July 28, 2018 Sorry again now im trying to remove: that menu item " Contacts/Sub-Accounts" i tried with <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { $primarySidebar->getChild('My Account') ->removeChild('Contacts/Sub-Accounts'); }); its remove fines but when i go to index.php im get this error Oops! Something went wrong and we couldn't process your request. Please go back to the previous page and try again. Error: Call to a member function removeChild() on null in /home/e8wobbakci9y/public_html/includes/hooks/removesub.php:8 i need to remove that option in PrimaryNavbar too. ill be greatful if you can help me. thanks for you time. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 28, 2018 Share Posted July 28, 2018 7 hours ago, TGK said: i need to remove that option in PrimaryNavbar too. for the menu, it's not in the PrimaryNavbar, it's in the SecondaryNavbar... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondaryNavbar', 1, function(MenuItem $secondaryNavbar) { if (!is_null($secondaryNavbar->getChild('Account'))) { $secondaryNavbar->getChild('Account') ->removeChild('Contacts/Sub-Accounts'); } }); 1 Quote Link to comment Share on other sites More sharing options...
TGK Posted July 28, 2018 Author Share Posted July 28, 2018 its works pefect. really thank you for your patience 0 Quote Link to comment Share on other sites More sharing options...
socialpoint24 Posted August 2, 2018 Share Posted August 2, 2018 I'm having a similar situation. This what I want to remove. This code removes it, but I get this error. <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { $primarySidebar->getChild('Domain Details Management') ->removeChild('Manage Private Nameservers'); }); Error: Call to a member function removeChild() on null in /home/hosti223/public_html/clients/includes/hooks/domaindetailsmanagementSidbar.php:8Stack trace:#0 /home/hosti223/public_html/clients/includes/hookfunctions.php(0): WHMCS\Utility\SafeInclude::{closure}(Object(WHMCS\View\Menu\Item))#1 /home/hosti223/public_html/clients/includes/clientareafunctions.php(0): run_hook('ClientAreaPrima...', Array, true)#2 /home/hosti223/public_html/clients/supporttickets.php(0): outputClientArea('supportticketsl...', false, Array)#3 {main} 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 2, 2018 Share Posted August 2, 2018 untested, but try... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { $DomainDetails = $primarySidebar->getChild("Domain Details Management"); if (empty($DomainDetails)) { return; } $DomainDetailsChildren = $DomainDetails->getChildren(); $keysToUnset = ['Manage Private Nameservers']; foreach($DomainDetailsChildren as $key => $Domain_details_child) { if (in_array($key, $keysToUnset)) { $DomainDetails->removeChild($key); } } }); 1 Quote Link to comment Share on other sites More sharing options...
socialpoint24 Posted August 3, 2018 Share Posted August 3, 2018 Thank You! Worked like a charm! 0 Quote Link to comment Share on other sites More sharing options...
hasan qazi Posted November 21, 2020 Share Posted November 21, 2020 My knowledge base and news section is not displaying on website end, in whmcs it is working fine, but when I tried to display it on website it shows Opps error. Further more i am sharing the link of my issue kindly resolve it asap, my client is disturbing. ERROR!! Error: Call to a member function setLabel() on null in /home2/behosted/public_html/includes/hooks/menu.php:43Stack trace:#0 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Hook/Manager.php(0): WHMCS\Utility\SafeInclude::{closure}(Object(WHMCS\View\Menu\Item))#1 /home2/behosted/public_html/vendor/illuminate/support/Facades/Facade.php(261): WHMCS\Hook\Manager->run('ClientAreaPrima...', Object(WHMCS\View\Menu\Item), false)#2 /home2/behosted/public_html/includes/functions.php(0): Illuminate\Support\Facades\Facade::__callStatic('run', Array)#3 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/ClientArea.php(0): run_hook('ClientAreaPrima...', Object(WHMCS\View\Menu\Item))#4 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/ClientArea.php(0): WHMCS\ClientArea->outputWithoutExit()#5 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Http/Message/AbstractViewableResponse.php(0): WHMCS\ClientArea->getOutputContent()#6 /home2/behosted/public_html/vendor/middlewares/utils/src/CallableHandler.php(39): WHMCS\Http\Message\AbstractViewableResponse->getBody()#7 /home2/behosted/public_html/vendor/middlewares/fast-route/src/FastRoute.php(96): Middlewares\Utils\CallableHandler::execute(Array, Array)#8 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/HandleProcessor.php(0): Middlewares\FastRoute->process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#9 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/Strategy/AssumingMiddlewareTrait.php(0): WHMCS\Route\Middleware\HandleProcessor->_process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#10 /home2/behosted/public_html/vendor/middlewares/utils/src/Dispatcher.php(76): WHMCS\Route\Middleware\HandleProcessor->process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#11 [internal function]: Middlewares\Utils\Dispatcher->Middlewares\Utils\{closure}(Object(WHMCS\Http\Message\ServerRequest))#12 /home2/behosted/public_html/vendor/middlewares/utils/src/Delegate.php(31): call_user_func(Object(Closure), Object(WHMCS\Http\Message\ServerRequest))#13 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/AbstractProxyMiddleware.php(0): Middlewares\Utils\Delegate->process(Object(WHMCS\Http\Message\ServerRequest))#14 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/Strategy/AssumingMiddlewareTrait.php(0): WHMCS\Route\Middleware\AbstractProxyMiddleware->_process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#15 /home2/behosted/public_html/vendor/middlewares/utils/src/Dispatcher.php(76): WHMCS\Route\Middleware\AbstractProxyMiddleware->process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#16 [internal function]: Middlewares\Utils\Dispatcher->Middlewares\Utils\{closure}(Object(WHMCS\Http\Message\ServerRequest))#17 /home2/behosted/public_html/vendor/middlewares/utils/src/Delegate.php(31): call_user_func(Object(Closure), Object(WHMCS\Http\Message\ServerRequest))#18 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/AbstractProxyMiddleware.php(0): Middlewares\Utils\Delegate->process(Object(WHMCS\Http\Message\ServerRequest))#19 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/Strategy/AssumingMiddlewareTrait.php(0): WHMCS\Route\Middleware\AbstractProxyMiddleware->_process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#20 /home2/behosted/public_html/vendor/middlewares/utils/src/Dispatcher.php(76): WHMCS\Route\Middleware\AbstractProxyMiddleware->process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#21 [internal function]: Middlewares\Utils\Dispatcher->Middlewares\Utils\{closure}(Object(WHMCS\Http\Message\ServerRequest))#22 /home2/behosted/public_html/vendor/middlewares/utils/src/Delegate.php(31): call_user_func(Object(Closure), Object(WHMCS\Http\Message\ServerRequest))#23 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/BackendPsr7Response.php(0): Middlewares\Utils\Delegate->process(Object(WHMCS\Http\Message\ServerRequest))#24 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/BackendPsr7Response.php(0): WHMCS\Route\Middleware\BackendPsr7Response->_process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#25 /home2/behosted/public_html/vendor/middlewares/utils/src/Dispatcher.php(76): WHMCS\Route\Middleware\BackendPsr7Response->process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#26 [internal function]: Middlewares\Utils\Dispatcher->Middlewares\Utils\{closure}(Object(WHMCS\Http\Message\ServerRequest))#27 /home2/behosted/public_html/vendor/middlewares/utils/src/Delegate.php(31): call_user_func(Object(Closure), Object(WHMCS\Http\Message\ServerRequest))#28 /home2/behosted/public_html/vendor/middlewares/utils/src/Dispatcher.php(56): Middlewares\Utils\Delegate->process(Object(WHMCS\Http\Message\ServerRequest))#29 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/BackendDispatch.php(0): Middlewares\Utils\Dispatcher->dispatch(Object(WHMCS\Http\Message\ServerRequest))#30 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/Strategy/AssumingMiddlewareTrait.php(0): WHMCS\Route\Middleware\BackendDispatch->_process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#31 /home2/behosted/public_html/vendor/middlewares/utils/src/Dispatcher.php(76): WHMCS\Route\Middleware\BackendDispatch->process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#32 [internal function]: Middlewares\Utils\Dispatcher->Middlewares\Utils\{closure}(Object(WHMCS\Http\Message\ServerRequest))#33 /home2/behosted/public_html/vendor/middlewares/utils/src/Delegate.php(31): call_user_func(Object(Closure), Object(WHMCS\Http\Message\ServerRequest))#34 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/RoutePathMatch.php(0): Middlewares\Utils\Delegate->process(Object(WHMCS\Http\Message\ServerRequest))#35 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/Strategy/AssumingMiddlewareTrait.php(0): WHMCS\Route\Middleware\RoutePathMatch->_process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#36 /home2/behosted/public_html/vendor/middlewares/utils/src/Dispatcher.php(76): WHMCS\Route\Middleware\RoutePathMatch->process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#37 [internal function]: Middlewares\Utils\Dispatcher->Middlewares\Utils\{closure}(Object(WHMCS\Http\Message\ServerRequest))#38 /home2/behosted/public_html/vendor/middlewares/utils/src/Delegate.php(31): call_user_func(Object(Closure), Object(WHMCS\Http\Message\ServerRequest))#39 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/WhitelistFilter.php(0): Middlewares\Utils\Delegate->process(Object(WHMCS\Http\Message\ServerRequest))#40 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/Strategy/DelegatingMiddlewareTrait.php(0): WHMCS\Route\Middleware\WhitelistFilter->_process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#41 /home2/behosted/public_html/vendor/middlewares/utils/src/Dispatcher.php(76): WHMCS\Route\Middleware\WhitelistFilter->process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#42 [internal function]: Middlewares\Utils\Dispatcher->Middlewares\Utils\{closure}(Object(WHMCS\Http\Message\ServerRequest))#43 /home2/behosted/public_html/vendor/middlewares/utils/src/Delegate.php(31): call_user_func(Object(Closure), Object(WHMCS\Http\Message\ServerRequest))#44 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/RoutableClientModuleRequest.php(0): Middlewares\Utils\Delegate->process(Object(WHMCS\Http\Message\ServerRequest))#45 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/Strategy/AssumingMiddlewareTrait.php(0): WHMCS\Route\Middleware\RoutableClientModuleRequest->_process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#46 /home2/behosted/public_html/vendor/middlewares/utils/src/Dispatcher.php(76): WHMCS\Route\Middleware\RoutableClientModuleRequest->process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#47 [internal function]: Middlewares\Utils\Dispatcher->Middlewares\Utils\{closure}(Object(WHMCS\Http\Message\ServerRequest))#48 /home2/behosted/public_html/vendor/middlewares/utils/src/Delegate.php(31): call_user_func(Object(Closure), Object(WHMCS\Http\Message\ServerRequest))#49 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/RoutableAdminRequestUri.php(0): Middlewares\Utils\Delegate->process(Object(WHMCS\Http\Message\ServerRequest))#50 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/Strategy/AssumingMiddlewareTrait.php(0): WHMCS\Route\Middleware\RoutableAdminRequestUri->_process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#51 /home2/behosted/public_html/vendor/middlewares/utils/src/Dispatcher.php(76): WHMCS\Route\Middleware\RoutableAdminRequestUri->process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#52 [internal function]: Middlewares\Utils\Dispatcher->Middlewares\Utils\{closure}(Object(WHMCS\Http\Message\ServerRequest))#53 /home2/behosted/public_html/vendor/middlewares/utils/src/Delegate.php(31): call_user_func(Object(Closure), Object(WHMCS\Http\Message\ServerRequest))#54 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/RoutableRequestUri.php(0): Middlewares\Utils\Delegate->process(Object(WHMCS\Http\Message\ServerRequest))#55 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/Strategy/AssumingMiddlewareTrait.php(0): WHMCS\Route\Middleware\RoutableRequestUri->_process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#56 /home2/behosted/public_html/vendor/middlewares/utils/src/Dispatcher.php(76): WHMCS\Route\Middleware\RoutableRequestUri->process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#57 [internal function]: Middlewares\Utils\Dispatcher->Middlewares\Utils\{closure}(Object(WHMCS\Http\Message\ServerRequest))#58 /home2/behosted/public_html/vendor/middlewares/utils/src/Delegate.php(31): call_user_func(Object(Closure), Object(WHMCS\Http\Message\ServerRequest))#59 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/RoutableRequestQueryUri.php(0): Middlewares\Utils\Delegate->process(Object(WHMCS\Http\Message\ServerRequest))#60 /home2/behosted/public_html/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/Strategy/AssumingMiddlewareTrait.php(0): WHMCS\Route\Middleware\RoutableRequestQueryUri->_process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#61 /home2/behosted/public_html/vendor/middlewares/utils/src/Dispatcher.php(76): WHMCS\Route\Middleware\RoutableRequestQueryUri->process(Object(WHMCS\Http\Message\ServerRequest), Object(Middlewares\Utils\Delegate))#62 [internal function]: Middlewares\Utils\Dispatcher->Middlewares\Utils\{closure}(Object(WHMCS\Http\Message\ServerRequest))#63 /home2/behosted/public_html/vendor/middlewares/utils/src/Delegate.php(31): call_user_func(Object(Closure), Object(WHMCS\Http\Message\ServerRequest))#64 /home2/behosted/public_html/vendor/middlewares/utils/src/Dispatcher.php(56): Middlewares\Utils\Delegate->process(Object(WHMCS\Http\Message\ServerRequest))#65 /home2/behosted/public_html/index.php(0): Middlewares\Utils\Dispatcher->dispatch(Object(WHMCS\Http\Message\ServerRequest))#66 {main} Website URL: https://behosted.pk/index.php/knowledgebase 0 Quote Link to comment Share on other sites More sharing options...
jayrhey Posted January 24, 2023 Share Posted January 24, 2023 Mine didn't do something. try to create files from templates/includes , lowendhost/includes still not running 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.