Mibew Messenger Community

General => Support => Topic started by: sottwell on May 07, 2015, 04:07:12 PM

Title: Session Integration
Post by: sottwell 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?
Title: Re: Session Integration
Post by: Dmitriy Simushev 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>"
Title: Re: Session Integration
Post by: sottwell 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.
Title: Re: Session Integration
Post by: sottwell 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>