Ricardo Mecca Posted July 15, 2018 Share Posted July 15, 2018 Hi, I need show in the home page of clientarea WHMCS 7 a value custom field, I trying various ways, but don't work. What the code to show the value custom field id of the customer in the six theme? 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted July 15, 2018 Share Posted July 15, 2018 Use ClientAreaPage action hook. If you are talking about Client Custom Fields you don't even need to query the database since these fields are always available when the client is loggedin. {$clientsdetails.customfields.2.value} Replace 2 with the Client Custom Field ID you are looking for. Alternatively create a php file in includes/hooks directory. You should rename somePrefix_ with something else to avoid function name collision. Copy the following code in the newly created file. use WHMCS\Database\Capsule; function somePrefix_ClientAreaPage($vars) { $clientCustomField = '2'; // Replace with the ID of your Client Custom Field $output['yourvariable'] = $vars['clientsdetails']['customfields'][$clientCustomField]['value']; return $output; } add_hook('ClientAreaPage', 1, 'somePrefix_ClientAreaPage'); $clientCustomField must be equal to the ID of the field that you are looking for. Now the value of your custom field is available in all pages of WHMCS and can be accessed in Smarty via {$yourvariable}. Of course you can rename it as you prefer by changing $output['yourvariable'] with $output['myawesomevariable']. With this approach the only difference is that you can freely define a name for your variable. If you wanted to show the value of a Product Custom Fields then ignore my answer. You'll need another action hook with a query to database. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 15, 2018 Share Posted July 15, 2018 In addition to what @Kian says, because you mention the client homepage, you could specifically use the ClientAreaPageHome hook rather than ClientAreaPage... but more than likely, you're thinking of outputting this either in a homepage panel or in an existing sidebar - each of which would require a different hook... basically, where/how you want to output this value will determine which hook to use. 0 Quote Link to comment Share on other sites More sharing options...
Ricardo Mecca Posted July 15, 2018 Author Share Posted July 15, 2018 Thanks people, I initied in customizing theme on the WHMCS 7, and the reply of @Kian help me. 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.