topdog2046 Posted June 30, 2015 Share Posted June 30, 2015 Hello, Firstly, I am new to these forums, and am trying to customize WHMCS to display a PIN for each client. I put code found at https://requests.whmcs.com/responses/support-pin-code Into templates: clientssummary.tpl and clientareahome.tpl Yet, nothing is displayed correctly. I can post my TPL files here, as maybe I'm doing something wrong? I'm using the latest WHMCS version which I believe is 5.1.14, if that's not correct, can someone correct me? Thank you for any help that can be provided. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 30, 2015 Share Posted June 30, 2015 I'm using the latest WHMCS version which I believe is 5.1.14, if that's not correct, can someone correct me? it's v5.3.14 - but I assume that was just a typo on your part. the code still works. in clientssummary.tpl, there is already <div class="clientssummarybox"> - so what you do is add the remaining code after that line. in clientareahome.tpl, add it before the {if $announcements} line of code... you can move it later, if you want to. 0 Quote Link to comment Share on other sites More sharing options...
Infopro Posted July 1, 2015 Share Posted July 1, 2015 ...I can post my TPL files here, as maybe I'm doing something wrong? ... Please don't post entire templates here. 0 Quote Link to comment Share on other sites More sharing options...
topdog2046 Posted July 1, 2015 Author Share Posted July 1, 2015 Hello, Do the 2 peaces of code below look correct? 1 <div class="alert alert-info">Codigo PIN:{php} {assign var='pin' value=$smarty.now|date_format:"%m"|cat:$clientsdetails.userid}<b>{$pin|md5|regex_replace:"/[^0-9]/":""|truncate:6:""} {/php} </b> </div> 2 <div class="title">PIN</div> {php} {assign var='pin' value=$smarty.now|date_format:"%m"|cat:$clientsdetails.userid} <center> <h1><b>$pin|md5|regex_replace:"/[^0-9]/":""|truncate:6:""} {/php}</b></h1> </center> </div> If not, what is the correct format of the above 2 peaces of code? The first set of code was placed before the {elseif $announcements} Part in clientareahome.tpl The second peace of code was placed within the clientssummarybox Part in the clientssummary.tpl file Was I doing all of that correctly? If not, what did I miss? Thanks. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 1, 2015 Share Posted July 1, 2015 Do the 2 pieces of code below look correct? you don't need the {php} tags - the original code from your above request works fine and doesn't include them. in admin/templates/blend/clientssummary.tpl @ line 40, you'll see the following line of code... <div class="clientssummarybox"> directly after that, add the code from the request thread... <div class="title">PIN</div> {assign var='pin' value=$smarty.now|date_format:"%m"|cat:$clientsdetails.userid} <center><h1><b>{$pin|md5|regex_replace:"/[^0-9]/":""|truncate:6:""}</b></h1></center> in templates/*your template*/clientareahome.tpl @ line 38, there is the announcements block of code... {if $announcements} <div class="alert alert-warning"> <p><strong>{$LANG.ourlatestnews}:</strong> {$announcements.0.text|truncate:100:'...'} - <a href="announcements.php?id={$announcements.0.id}" class="btn btn-mini">{$LANG.more}...</a></p> </div> either before or after that, add your code... <div class="alert alert-info">Código PIN:{assign var='pin' value=$smarty.now|date_format:"%m"|cat:$clientsdetails.userid}<b>{$pin|md5|regex_replace:"/[^0-9]/":""|truncate:6:""}</b></div> 0 Quote Link to comment Share on other sites More sharing options...
topdog2046 Posted July 1, 2015 Author Share Posted July 1, 2015 you don't need the {php} tags - the original code from your above request works fine and doesn't include them. in admin/templates/blend/clientssummary.tpl @ line 40, you'll see the following line of code... <div class="clientssummarybox"> directly after that, add the code from the request thread... <div class="title">PIN</div> {assign var='pin' value=$smarty.now|date_format:"%m"|cat:$clientsdetails.userid} <center><h1><b>{$pin|md5|regex_replace:"/[^0-9]/":""|truncate:6:""}</b></h1></center> in templates/*your template*/clientareahome.tpl @ line 38, there is the announcements block of code... {if $announcements} <div class="alert alert-warning"> <p><strong>{$LANG.ourlatestnews}:</strong> {$announcements.0.text|truncate:100:'...'} - <a href="announcements.php?id={$announcements.0.id}" class="btn btn-mini">{$LANG.more}...</a></p> </div> either before or after that, add your code... <div class="alert alert-info">Código PIN:{assign var='pin' value=$smarty.now|date_format:"%m"|cat:$clientsdetails.userid}<b>{$pin|md5|regex_replace:"/[^0-9]/":""|truncate:6:""}</b></div> Hi, Thanks so much for your help. The only thing now I see wrong is when the admin views the PIN, it's different from when the client views it. For instance. Admin sees. PIN: 123456 The client sees PIN: 098765 Which means it doesn't match. How can I get this to match what the admin sees to the client? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 1, 2015 Share Posted July 1, 2015 you must be looking at different clients in admin and client areas - if I try it, the PIN numbers match in both client and admin areas for each separate client. 0 Quote Link to comment Share on other sites More sharing options...
topdog2046 Posted July 1, 2015 Author Share Posted July 1, 2015 you must be looking at different clients in admin and client areas - if I try it, the PIN numbers match in both client and admin areas for each separate client. Nope. The same client. When I go to the admin's summary and click on the client's name, under their profile, it displays 1 Pin. When the client themselves login, they see a different PIN. Should I try and clear templates_C perhaps? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 1, 2015 Share Posted July 1, 2015 Should I try and clear templates_C perhaps? yes - goto utilities -> system -> system cleanup -> empty template cache. 0 Quote Link to comment Share on other sites More sharing options...
topdog2046 Posted July 1, 2015 Author Share Posted July 1, 2015 That did it, though I cleared templates_c through FTP. Is there a way I can put in a custom field to validate the client's PIN? If so, how do I do it? And what validation code can I use? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 1, 2015 Share Posted July 1, 2015 Is there a way I can put in a custom field to validate the client's PIN? where do you want to validate it and why? btw - i've checked and the above code works in v6, you'll probably need to remove the HTML formatting from the client code, but it all works. 0 Quote Link to comment Share on other sites More sharing options...
topdog2046 Posted July 1, 2015 Author Share Posted July 1, 2015 where do you want to validate it and why? btw - i've checked and the above code works in v6, you'll probably need to remove the HTML formatting from the client code, but it all works. HTML meaning the <b></b>? And as to the validation, I was going to add it in the department so it'd show up in a customer's support ticket. The purpose would be that that'd be a way to verify that support has the right customer. If he/she enters the PIN, then support will know that, yes, we have the right person and they aren't making up some 6 digit number of their own. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 1, 2015 Share Posted July 1, 2015 HTML meaning the <b></b>? yes, aspects of the v6 client templates are quite different to the v5 templates... you'll likely need to use something like... <div>Código PIN: {assign var='pin' value=$smarty.now|date_format:"%m"|cat:$clientsdetails.userid}{$pin|md5|regex_replace:"/[^0-9]/":""|truncate:6:""}</div> And as to the validation, I was going to add it in the department so it'd show up in a customer's support ticket. The purpose would be that that'd be a way to verify that support has the right customer.If he/she enters the PIN, then support will know that, yes, we have the right person and they aren't making up some 6 digit number of their own. wouldn't it be simpler to just make the client login to create a support ticket - that way, they at least have to know the login details? remember that this PIN number changes monthly for each client - so a client could correctly use one PIN number on 31st July, and then if they tried to use it again the next day, 1st August, it would be incorrect... effectively on 1st August, they would need to login to the client area in order to get the new PIN number. but to answer your question, you could setup a support custom field, and use simple regex to check it's a 6-digit number... /^[0-9]{6}$/ I suppose you could also modify the template to check if this figure equals the PIN, but there may be no point when the PIN changes on a monthly basis. 0 Quote Link to comment Share on other sites More sharing options...
techwthquestion Posted May 22, 2016 Share Posted May 22, 2016 Hello This code work well on 6.3 as well. However this code generate simple 6 digits now. How can I get pin like :: 366994-ULYSU ? I tried to edit code accordingly but didnt work for me. Can you please suggest ? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 22, 2016 Share Posted May 22, 2016 This code work well on 6.3 as well. However this code generate simple 6 digits now. How can I get pin like :: 366994-ULYSU ? I tried to edit code accordingly but didnt work for me. Can you please suggest ? try the following and it should generate what you want... in the admin area clientsummary.tpl template... <div>PIN: {assign pin $smarty.now|date_format:"%m"|cat:$clientsdetails.userid}{$pin|md5|regex_replace:"/[^0-9]/":""|truncate:6:""}-{$pin|md5|base_convert:'10':'26'|regex_replace:"/[^a-z]/":""|truncate:5:""|strtoupper}</div> and in the client area clienthome.tpl template... <div class="alert alert-info">PIN:{assign pin $smarty.now|date_format:"%m"|cat:$clientsdetails.userid}<b>{$pin|md5|regex_replace:"/[^0-9]/":""|truncate:6:""}-{$pin|md5|base_convert:'10':'26'|regex_replace:"/[^a-z]/":""|truncate:5:""|strtoupper}</b></div> both parts of the password (numbers-letters) will change at the start of each month... it's probably not the most secure way to do it, and if you could do it in PHP, then it would be more secure... but for what it's needed for, it should be perfectly fine... it's no less secure than just the 6-digit pin anyway. 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.