Jump to content

Change sidebar item text on client's cPanel product page


Recommended Posts

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated