krlos777 Posted October 29, 2020 Share Posted October 29, 2020 Hello, I am trying to modify the client sidebar using the following code: <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { $primarySidebar->getChild("My Account") ->getChild("Billing Information") ->setLabel("Custom Text Here"); }); But when I reload client area I get this error: Error: Call to a member function getChild() on null in ..... 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 31, 2020 Share Posted October 31, 2020 the problem with that hook is that you're not first checking whether what you want to modify exists on the current page before trying to modify it - so I imagine it would work fine on a page where that sidebar child exists, but fail on every other page. but if all you're wanting to do is change a label on a default sidebar child, then you don't need to use a hook for that, you can use Language Overrides instead. $_LANG['sidebars']['viewAccount']['billingInformation'] = "Billing Information"; just follow the instructions in the docs to create an overrides folder in the /lang file and add your changes to that string for each language within their own file in that new folder. 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.