Jump to content

Get logged in user name and email address


Recommended Posts

Hi there,

I am using a live chat app called Natterly. To set it up is simple all you need to do is add a bit of JS into the footer:
 

<script type="text/javascript" src="https://cdn.natterly.com/chatbox.js"></script>
<script>
  chatbox = new NatterlyChatbox("[My licence goes here]");
  chatbox.render();
</script>

 

Now this works fine in WHMCS but I want to go one step further. Usually to start a chat the user has to enter their name and email address into the chat box. Natterly allows you to specify this within the script like so:

<script type="text/javascript" src="https://cdn.natterly.com/chatbox.js"></script>
<script>
  chatbox = new NatterlyChatbox("[My licence goes here]");
  chatbox.visitor.name = '<visitor name here>';
  chatbox.visitor.emailAddress = '<visitor email address here>';
  chatbox.render();
</script>

What I would like to do is grab the current logged in user's full name and email address and insert it into this script. Does anybody have any ideas on how to do this? I have tried but couldn't get it working.

Thanks in advance,

Hayden

Link to comment
Share on other sites

Hi Hayden,

23 hours ago, tigerstripemedia said:

What I would like to do is grab the current logged in user's full name and email address and insert it into this script. Does anybody have any ideas on how to do this? I have tried but couldn't get it working.

I would have thought you should be able to do this...

<script type="text/javascript" src="https://cdn.natterly.com/chatbox.js"></script>
<script>
  chatbox = new NatterlyChatbox("[My licence goes here]");
  chatbox.visitor.name = '{$clientsdetails.fullname}';
  chatbox.visitor.emailAddress = '{$clientsdetails.email}';
  chatbox.render();
</script>

if the client isn't logged in, then both values should be empty.

Link to comment
Share on other sites

3 minutes ago, brian! said:

Hi Hayden,

I would have thought you should be able to do this...


<script type="text/javascript" src="https://cdn.natterly.com/chatbox.js"></script>
<script>
  chatbox = new NatterlyChatbox("[My licence goes here]");
  chatbox.visitor.name = '{$clientsdetails.fullname}';
  chatbox.visitor.emailAddress = '{$clientsdetails.email}';
  chatbox.render();
</script>

if the client isn't logged in, then both values should be empty.

Thanks so much Brian! That's worked!

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