Mibew Messenger Community

General => Support => Topic started by: gupadilha on February 13, 2009, 03:18:18 PM

Title: Can I use my application user as Visitor?
Post by: gupadilha on February 13, 2009, 03:18:18 PM
There is a way to send thru the chat button (popup url) the user logged in my application and the webim get it and use as visitor?

May be something like : "http://<HOST>/webim/client.php?locale=en&style=default&visitor=<USERID>"

Tks!
Title: Re: Can I use my application user as Visitor?
Post by: Inspirer on February 13, 2009, 04:10:11 PM
If you want just pass the default name of the visitor, look in libs/chat.php. Function visitor_from_request().
Default name is detected there.

I like this idea and will add "visitor" argument into 1.5.2.

-------

If you want to integrate webim with your PHP application, you can share the session between them:
Modify libs/chat.php.

function visitor_from_request() {
.......
   return array( 'id' => $userId, 'name' => $userName );
}

Add something like:

if(isset($_SESSION['userid'])) {
    $userId = $_SESSION['userid'];
}

Change "Settings -> general -> Visitor's identifier" to see visitor's id: "{name} {id}".
If you allow only logged in visitors to chat, disable "Settings -> Optional Services -> Allows users to change their names".

PS: Also look here (http://mibew.org/forums/index.php?topic=33.0)
Title: Re: Can I use my application user as Visitor?
Post by: gupadilha on February 13, 2009, 06:30:14 PM
It is a Java (J2EE) application, not php!
 ;)