Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

How to for Candy #12

Closed
hanynowsky opened this issue Feb 19, 2015 · 1 comment
Closed

How to for Candy #12

hanynowsky opened this issue Feb 19, 2015 · 1 comment

Comments

@hanynowsky
Copy link

Can yu please give a clearer example on how to integrate this plugin to the Candy chat.
I cannot make it work. MAybe I did not understand how I should call the lib and where I should put the code.

@rszabo
Copy link

rszabo commented Feb 26, 2015

@hanynowsky It's on the main page for this repo.

  1. In say login.php, bootstrap your site and pass provided username and password to the XMPP_Prebind constructor.
  2. If login is successful you receive:
    $sessionInfo = $xmppPrebind->getSessionInfo(); // array containing sid, rid and jid
  3. Store
    $sessionInfo['rid'], $sessionInfo['sid'] and $sessionInfo['jid']
    to say $_SESSION, or wherever.
  4. In the page after login.php, i.e. index.php, you once again bootstrap your site, include all the Candy JS, and attach to the session using:

Candy.Core.attach('<?php echo $_REQUEST['jid'] ?>', '<?php echo $_REQUEST['sid'] ?>', '<?php echo $_REQUEST['rid'] ?>');

Please keep in mind that this example is extremely simplified. You really need to check the variables properly and also when auth() is ran, make sure it gives you boolean true as result before attempting to read session-info or redirecting to any page.

@mweibel mweibel closed this as completed Feb 26, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants