Jump to content

Support PIN Code for WHMCS 5 Templates


Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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. :idea:

Link to comment
Share on other sites

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. :idea:

 

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.

Link to comment
Share on other sites

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>

 

5OHYiYU.png

 

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. :)

Link to comment
Share on other sites

  • 10 months later...
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. :idea:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated