Author Topic: Session Integration  (Read 6378 times)

0 Members and 1 Guest are viewing this topic.

sottwell

  • Jr. Member
  • **
  • Posts: 3
  • MODX User
    • MODX Articles and Tutorials
Session Integration
« on: May 07, 2015, 04:07:12 PM »
Several years ago I installed this for a client, and was able to use the visitor's existing session to pre-load the visitor's name into the popup. The Javascript for the popup was in a block that is parsed by the CMS, so I was able to use something like this

Code: [Select]
{user.username}
which the CMS would parse to return the visitor's username.

I don't see any simple way of doing this now. Any suggestions on how to reproduce this type of integration?

Dmitriy Simushev

  • Moderator
  • Native
  • *****
  • Posts: 345
Re: Session Integration
« Reply #1 on: May 08, 2015, 10:49:34 AM »
First of all I assume that you use Mibew 2.0.0. If you don't you should update your installation.

You could pass custom user name and email from you CMS to Mibew thread using "name" and "email" GET params respectively. Take a look at Mibew button's code. You should replace

Code: [Select]
Mibew.ChatPopup.init({"id":"<unique button code>","url":"\/mibew\/chat?locale=en"
with

Code: [Select]
Mibew.ChatPopup.init({"id":"<unique button code>","url":"\/mibew\/chat?locale=en&name=<user name>&email=<email address>"

sottwell

  • Jr. Member
  • **
  • Posts: 3
  • MODX User
    • MODX Articles and Tutorials
Re: Session Integration
« Reply #2 on: May 09, 2015, 03:05:36 AM »
Of course! I remember now. Thank you. I knew it was something simple.

That client has long since taken their site in-house so I have no idea what they're doing for online support now. I'm working with the latest version at the moment.

sottwell

  • Jr. Member
  • **
  • Posts: 3
  • MODX User
    • MODX Articles and Tutorials
Re: Session Integration
« Reply #3 on: May 09, 2015, 03:29:49 AM »
For any MODX users out there, it looks like this:

Code: [Select]
<script type="text/javascript">Mibew.ChatPopup.init({
    "id":"<unique button code>",
    "url":"http:\/\/domain.com\/mibew\/index.php\/chat?locale=en&name=[[+modx.user.id:userinfo=`username`]]&email=[[+modx.user.id:userinfo=`email`]]",
    ...
</script>
« Last Edit: May 09, 2015, 03:31:20 AM by sottwell »