SMOKEY_TEK Posted July 29, 2009 Share Posted July 29, 2009 I don't know if this would be in the right place to post this topic, but I am new to this forum, So please forgive me for posting this in here... Ok, I downloaded the AJAX Web Chat from http://www.blueimp.net Im just wondering how I could code it to make it where players that are logged in on my game site and when they click on Chat and it logs them in automatically, without having to use a username and password. If their admin/moderator/etc they would get that power in the chat... Please help... I found a little about how to do it, but I am not a php programmer just yet.. Here is some info So what you want to write is a custom integration. Of course everything you mention is possible as it's been done with several systems, including that profile link. For logging users in though, rather than injecting code into the login page (not sure what code you're trying to put there) we use the function getValidLoginUserData() which is inside lib/class/CustomAJAXChat.php In the standalone version, that function doesn't do much. It calls the function getCustomUsers() which pulls them from the file. In the integration versions it asks the forums for the data it needs. The function is fairly simple, and it's best to use it to get what you need. The description of the function looks like this: function getValidLoginUserData() { $customUsers = $this->getCustomUsers(); if($this->getRequestVar('password')) { // Check if we have a valid registered user: $userName = $this->getRequestVar('userName'); $userName = $this->convertEncoding($userName, $this->getConfig('contentEncoding'), $this->getConfig('sourceEncoding')); $password = $this->getRequestVar('password'); $password = $this->convertEncoding($password, $this->getConfig('contentEncoding'), $this->getConfig('sourceEncoding')); foreach($customUsers as $key=>$value) { if(($value['userName'] == $userName) && ($value['password'] == $password)) { $userData = array(); $userData['userID'] = $key; $userData['userName'] = $this->trimUserName($value['userName']); $userData['userRole'] = $value['userRole']; return $userData; } } return null; } else { // Guest users: return $this->getGuestUser(); } } So all you need to do is provide it with a way to get the userName, userID, and userRole for your users. If you can provide this function with that information, chat will handle everything else. So if you already have users logged in to your forum, whatever php code you're trying to add to logged in should, instead, provide its data to this function. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.