Skip to content

Commit 90072a8

Browse files
authored
Fixes bug with setting the user unique identifier
1 parent 21f4eca commit 90072a8

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

chatwoot/hooks.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/***************************************************************************
44
// * *
5-
// * Chatwoot WHMCS Addon (v1.0). *
5+
// * Chatwoot WHMCS Addon (v1.1). *
66
// * This addon modules enables you integrate Chatwoot with your WHMCS *
77
// and leverage its powerful features. *
88
// * Tested on WHMCS Version: 7.9.2 (7.9.2-release.1). *
@@ -51,7 +51,12 @@ function hook_chatwoot_footer_output($vars) {
5151

5252
// Get client ID
5353
if ($vars['clientsdetails']['id']) {
54-
$clientid = $vars['clientsdetails']['id'];
54+
$varsID = $vars['clientsdetails']['id'];
55+
}
56+
if (!is_null($client)){
57+
$clientid = hash_hmac("sha256", $varsID, "nQ1ayoG5bu580LZkSxMJiO2");
58+
} else {
59+
$clientid = uniqid('v-', true);
5560
}
5661

5762
// Get client email
@@ -75,7 +80,9 @@ function hook_chatwoot_footer_output($vars) {
7580
<script>
7681
window.onload = (event) => {
7782
window.\$chatwoot.setUser('$clientid', {
78-
avatar_url: '$gravatarurl',
83+
email: '$clientemail',
84+
name: '$clientname',
85+
avatar_url: '$gravatarurl',
7986
})
8087
window.\$chatwoot.setLabel('$chatwoot_label')
8188
}

0 commit comments

Comments
 (0)