WHMCS Support Manager WHMCS John Posted July 8, 2019 WHMCS Support Manager Share Posted July 8, 2019 The template system used by WHMCS makes it easy to add extra variables wherever extra information should be displayed. In this example I'll demonstrate how to add the Client ID to the invoice page. This same process can be used to display any bit of available client data to almost any client area page. 1. Locate the template relating to the page you wish to modify. In this example I'm using viewinvoice.tpl. Template files are located in the /templates/*your active template*/ directory. I recommend making customisations to a custom template to ensure they are maintained following an update. More details are located here: https://developers.whmcs.com/themes/getting-started/ 2. At the top of the file, add the following code: {debug} Save the file and upload it to the server. 3. Visit the page in your browser, and you'll see a popup appear. This contains all the template variables and language strings available on this page. Identify the variable you want to use, in this case it's the $clientsdetails array I need because it contains the userid: 4. If the variable to use is a simple key-value pair, then it can be output simply by adding the merge field like this to the template file: {$filename} However in this example the client userid is contained within an array. So the format to add to viewinvoice.tpl is: {$clientsdetails.userid} Add the merge field into the template wherever you'd like to display the extra variables. I've added it beneath the client's name: 5. Once you're happy, remove the {debug} tag, save and upload the template file. Et Voila! The Client ID is now displayed on the invoice page: ProTip: This also works for email templates too! Sent the email to a client, then view the message via Utilities > Logs > Email Log. For further reading, please refer to https://developers.whmcs.com/themes/variables/ Feel free to modify it to suit your needs and I hope it helps! 1 Quote Link to comment Share on other sites More sharing options...
mfoland Posted July 8, 2019 Share Posted July 8, 2019 I think making the user number longer would benefit if you were sending the invoice off to collection company, etc if your company did that. Unless you were to keep the user ID normal, and add a custom field with some random numbers through php... Just a thought. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 8, 2019 Share Posted July 8, 2019 29 minutes ago, mfoland said: I think making the user number longer would benefit if you were sending the invoice off to collection company, etc if your company did that. you could add leading zeros to it using Smarty modifiers if you wanted to. 31 minutes ago, mfoland said: Unless you were to keep the user ID normal, and add a custom field with some random numbers through php... Just a thought. though I would have thought a userID on an invoice is of limited use considering the value is only used internally in WHMCS.... but I know it's just an example variable. 🙂 0 Quote Link to comment Share on other sites More sharing options...
Remitur Posted July 8, 2019 Share Posted July 8, 2019 5 hours ago, WHMCS John said: 2. At the top of the file, add the following code: {debug} You can do so only if you are in test environment: doing so in production environment, all of your users will access to that data too... and this is a security issue. If you want to do it in production environment, use this command: {if $adminLoggedIn}{debug}{/if} Credit: old trick by @brian! 😉 0 Quote Link to comment Share on other sites More sharing options...
zarvis Posted October 1, 2019 Share Posted October 1, 2019 Hi, Is it possible to display the dedicated IP on the invoice section? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 2, 2019 Share Posted October 2, 2019 On 01/10/2019 at 09:56, zarvis said: Is it possible to display the dedicated IP on the invoice section? 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.