Trax Posted June 22, 2016 Share Posted June 22, 2016 Hey, i am trying to remove the "Login to cPanel" and "Login to webmail" links. I have managed to remove them with this code <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { $primarySidebar->getChild('Service Details Actions') ->removeChild('Login to cPanel') ->removeChild('Login to Webmail') ->removeChild('Change Password'); }); Only issue is, when i now go to /clientarea.php?action=services i get a error 500 page? Any ideas why? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted June 22, 2016 Share Posted June 22, 2016 (edited) you should use the is_null function always to avoid error 500 <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { if (!is_null($primarySidebar->getChild('Service Details Actions'))){ $servicesDetails = $primarySidebar->getChild('Service Details Actions'); if (!is_null($servicesDetails->removeChild('Login to cPanel'))){ $servicesDetails->removeChild('Login to cPanel'); } if (!is_null($servicesDetails->removeChild('Login to Webmail'))){ $servicesDetails->removeChild('Login to Webmail'); } if (!is_null($servicesDetails->removeChild('Change Password'))){ $servicesDetails->removeChild('Change Password'); } } }); Edited June 22, 2016 by sentq 0 Quote Link to comment Share on other sites More sharing options...
Trax Posted June 22, 2016 Author Share Posted June 22, 2016 Thanks for that but it doesn't work, it just takes down the whole of the whmcs installation? 0 Quote Link to comment Share on other sites More sharing options...
twhiting9275 Posted June 22, 2016 Share Posted June 22, 2016 If you turn on display errors (admin -> setup -> general settings -> other), then reapply the code, what's the error shown? <edit> Make sure you turn them back off after you're done 0 Quote Link to comment Share on other sites More sharing options...
Trax Posted June 22, 2016 Author Share Posted June 22, 2016 If you turn on display errors (admin -> setup -> general settings -> other), then reapply the code, what's the error shown? <edit> Make sure you turn them back off after you're done Parse error: syntax error, unexpected '{' in /home/xxxxxxxx/public_html/includes/hooks/side-menus.php on line 7 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted June 22, 2016 Share Posted June 22, 2016 Parse error: syntax error, unexpected '{' in /home/xxxxxxxx/public_html/includes/hooks/side-menus.php on line 7 I've updated my code, there was ")" missing, place it again in your file and check 0 Quote Link to comment Share on other sites More sharing options...
Trax Posted June 22, 2016 Author Share Posted June 22, 2016 That works a treat. Thanks sentq, much appreciated! 0 Quote Link to comment Share on other sites More sharing options...
HostGenius Posted June 24, 2016 Share Posted June 24, 2016 Thanks for the hook 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.