mywebhostingaccount Posted June 12, 2020 Share Posted June 12, 2020 Hi, I'm trying to change the label text of the "Change Password" sidebar menu item, which displays to the customer when on the cPanel product page. I want to make it more clear that this is the cPanel password, not the main account password. I have tried a dozen or so different variations of code, and none of them have worked. This is the last one I tried. Any ideas? <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { if (!is_null($primarySidebar->getChild('Service Details Actions'))) { $primarySidebar->getChild('Change Password') ->setLabel('Change cPanel Password'); } }); Thanks, Noah 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 12, 2020 Share Posted June 12, 2020 Hi Noah, technically as a hook it would be... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { if (!is_null($primarySidebar->getChild('Service Details Actions'))) { $primarySidebar->getChild('Service Details Actions')->getChild('Change Password')->setLabel('Change cPanel Password'); } }); however, if all you are wanting to do is change the label of a default sidebar, then you could use Language Overrides and adjust the strings int eh languages used on your site. $_LANG['serverchangepassword'] = "Change Password"; the caveat I would give to either solution is that you're not checking whether the current service is a cPanel account - now if you only provide cPanel accounts, then this isn't relevant - but if you were in a situation, where you were offering cPanel and Plesk options, you wouldn't want it to say cPanel in the label if it were a Plesk account password. 0 Quote Link to comment Share on other sites More sharing options...
mywebhostingaccount Posted June 15, 2020 Author Share Posted June 15, 2020 Thank you Brian. Worked perfectly! I just offer cPanel at the moment, but will have to keep that in mind if I add another service in the future. Thanks! Noah 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.