TechLineX Posted June 14, 2016 Share Posted June 14, 2016 Hello WHMCS-Community, how is it possible to show the customers ID for them in their clientarea? Regards 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 14, 2016 Share Posted June 14, 2016 if you want to show it by editing a template, you could use... {$clientsdetails.id} if you want to show it in the navbar/sidebar/panel, then you'd need to use an action hook - which one will depend on where you want to display the customer ID. 0 Quote Link to comment Share on other sites More sharing options...
TechLineX Posted June 14, 2016 Author Share Posted June 14, 2016 I want it to show it in "My details" at the left in the sidebar. Is it possible to integrate it simply via a template file? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 14, 2016 Share Posted June 14, 2016 I want it to show it in "My details" at the left in the sidebar. Is it possible to integrate it simply via a template file? i'm afraid not - you're going to need an action hook. i've posted one very similar previously... http://forum.whmcs.com/showthread.php?111614-how-can-i-hide-some-fields&p=457799#post457799 i've modified the code for you to show the customer ID... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) { $client = Menu::context('client'); if($client->companyname != ""){ $name = '<strong>'.$client->companyname.'</strong>'; } else { $name = '<strong>'.$client->fullname.'</strong>'; } $address1 = $client->address1; if($client->address2 != ""){ $address2 = '<br>'.$client->address2; } else { $address2=''; } $city = ' '.$client->city; $state = '<br>'.$client->state; $postcode = '<br>'.$client->postcode; $country = '<br>'.$client->countryname; $clientid = '<br><br>Customer ID: '.$client->id; $address_new = $name.'<p>'.$address1.$address2.$postcode.$city.$state.$country.$clientid.'</p>'; if (!is_null($primarySidebar->getChild('Client Details'))) { $primarySidebar->getChild('Client Details') ->setBodyHtml($address_new); } }); to use it, just create a file within /includes/hooks, call it customeridsidebar.php and paste the above code into it. 0 Quote Link to comment Share on other sites More sharing options...
TechLineX Posted June 14, 2016 Author Share Posted June 14, 2016 i´ve created a file and pasted the code, but nothing happened. - - - Updated - - - Sorry, worked now for me. Thank you!! 0 Quote Link to comment Share on other sites More sharing options...
pjs32 Posted June 14, 2016 Share Posted June 14, 2016 Nice Hook Brian - thanks! 0 Quote Link to comment Share on other sites More sharing options...
ITWolfy Posted June 17, 2016 Share Posted June 17, 2016 Thanks Brian !! 0 Quote Link to comment Share on other sites More sharing options...
Tiaan Posted August 3, 2022 Share Posted August 3, 2022 On 6/14/2016 at 6:39 PM, brian! said: i'm afraid not - you're going to need an action hook. i've posted one very similar previously... http://community.whmcs.com/showthread.php?111614-how-can-i-hide-some-fields&p=457799#post457799 i've modified the code for you to show the customer ID... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) { $client = Menu::context('client'); if($client->companyname != ""){ $name = '<strong>'.$client->companyname.'</strong>'; } else { $name = '<strong>'.$client->fullname.'</strong>'; } $address1 = $client->address1; if($client->address2 != ""){ $address2 = '<br>'.$client->address2; } else { $address2=''; } $city = ' '.$client->city; $state = '<br>'.$client->state; $postcode = '<br>'.$client->postcode; $country = '<br>'.$client->countryname; $clientid = '<br><br>Customer ID: '.$client->id; $address_new = $name.'<p>'.$address1.$address2.$postcode.$city.$state.$country.$clientid.'</p>'; if (!is_null($primarySidebar->getChild('Client Details'))) { $primarySidebar->getChild('Client Details') ->setBodyHtml($address_new); } }); to use it, just create a file within /includes/hooks, call it customeridsidebar.php and paste the above code into it. Hi there, I know this is an old thread but i like the idea I just have one question. How can I make something with the same idea but instead of a customer id like a number. It says the clients name like "Welcome back John" and then also like a breadcrumb trail below that, that then shows the Customer Code like JHN310 basically an abstract of the clients name and a randomly generated number? Theme I am using is the control theme, the default order form template is Control Alternative Compare (Default). (Not sure if this helps) 0 Quote Link to comment Share on other sites More sharing options...
DennisHermannsen Posted August 4, 2022 Share Posted August 4, 2022 @Tiaan that would require a way to store the ID - most likely in the database. You would need to create a separate table. During the ClientAdd event, you need to generate the customer code and store it in the database. 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.