Loading...
 
Features / Usability

Features / Usability


Re: Autologin to Ajax chat

posts: 80 Austria

OK, i maanged to integrate the aoutlogin of ajax Chat into tikiwiki, path for ajax chat is tiki/chat:

in custom.php:

Image
require('../tiki-setup.php');


In CustomAJAXChat.php:

Image
// Initialize custom request variables: function initCustomRequestVars() { global $user, $tiki_p_admin, $userlib; include('../lib/userslib.php'); //needed for UserID //echo " tiki_p_admin: " . $tiki_p_admin; // Auto-login tikiwiki users: if(!$this->getRequestVar('logout') && $user != '') { $this->setRequestVar('userName', $user); $this->setRequestVar('userID', $userlib->get_user_id($user)); $this->setRequestVar('userRole', AJAX_CHAT_USER); if ($tiki_p_admin == 'y') { $this->setRequestVar('userRole', AJAX_CHAT_ADMIN); } $this->setRequestVar('login', true); } } // Returns an associative array containing userName, userID and userRole // Returns null if login is invalid function getValidLoginUserData() { $customUsers = $this->getCustomUsers(); //echo "Role: ".$this->getRequestVar('userRole'); if($this->getRequestVar('userName')) { // Check if we have a valid registered user: $userName = $this->getRequestVar('userName'); $userName = $this->convertEncoding($userName, $this->getConfig('contentEncoding'), $this->getConfig('sourceEncoding')); $userData = array(); $userData['userID'] = $this->getRequestVar('userID'); $userData['userName'] = $userName; $userData['userRole'] = $this->getRequestVar('userRole'); // print_r($userData); return $userData; } return null; }