Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 280 Vote(s) - 3.49 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to change the displayed customer name in WHMCS clientarea?

#1
I got a working WHMCS setup. I think, that I basically know what I'm doing (did several addons, all work great) but there is one thing I was not able to solve yet.

Let's imagine a client of mine, called John Doe. In the clientarea, is says 'Welcome back, John!'. How can I change this? I want it to display 'Welcome back, John Doe'. Also, at the top right (with the Six theme), the user settings are displayed with the first name only.

How can I change the way that WHMCS displays the customer's name in the clientarea?
Reply

#2
Wow, no response from WHMCS team... maybe they don't even now how to do this themselves... ;-)

Anyways, I found the ways to to this. In order to replace both the "Welcome back" page title and the menu heading, you will need two hooks.

Use this hook to replace the menu title of the dropdown (top right with "six" template):

<?php
use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondaryNavbar', 1, function (MenuItem $secondaryNavbar)
{
$secondaryNavbar->getChild('Account')->setLabel('My account'); // Or whatever you like
});

The other one is trickier, because the customers name is not editable from within the template files. You also need a hook for this one:

<?php
use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPage', 1, function ($vars)
{
if($vars['templatefile'] == 'clientareahome'){
$vars['displayTitle'] = 'Welcome back!';
}
// If you want to use client's details, use $vars['clientsdetails']
return $vars;
});

Good luck!
Reply



Forum Jump:


Users browsing this thread:
2 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through