http://www.kuferl.eu/pickup
Hi. I want to use the chat with a custom login that is achieved with the steam login. I store the username in $_SESSION and want to use it for the chat with the pfc hook pfc.before.auth.
This is the hook i wrote in server/config.php :
- Code: Select all
$GLOBALS['pfc_hooks']['pfc.before.auth'][5] = function ($app, $req, $res) {
return function () use ($app, $req, $res) {
if(isset($_SESSION['nick'])){
return $_SESSION['nick'];
}
};
};
Furthermore i changed the pfc.showAuthForm function to this:
- Code: Select all
pfc.showAuthForm = function (msg) {
pfc.modalbox.open(
'<form>'
+ ' <div class="popup-login">'
+ ' You need to be logged in to see the chat'
+ ' </div>');
};
return pfc;
}(phpFreeChat || {}, jQuery, window));/*jslint node: true, maxlen: 150, maxerr: 50, indent: 2 */
My main problems here are those 2:
1) sometimes it doesn't log you in and shows the login message (You need to be logged in...)
2) it doesn't remove you from the chat after logging out. The logout works by simply destroying the session.