Invision Power Board (IPB) Integration?
Fully customizable web chat created using AJAX.
Brought to you by:
frug,
madblueimp
Has anybody tried integrating this with IPB message boards, similar to how there's a VB and phpBB version? I'm not too code savvy, but I'm willing to give it a go since this is by far the best free chat application I've stumbled across yet. I figured I'd ask if somebody else might already have figured out what to put in /lib/custom.php before I spent a few hours working on it myself.
Phil, thanks for the tip, but I actually use TextMate on a Macbook. Haven't touched Notepad in years :)
I've got a copy of Coda somewhere around here though. I'll try using that and seeing if it helps any.
I take it by the silence that it's a negative on an IPB integration? I had a further look at the code and realized it's a bit above my skill level.
I'd be willing to pay for somebody to integrate this with IPB, hint hint :D
I just completed th AJAX Chat integration with IPB :
First download IPBWI (Invision Power Board Website Integration), it's easy to find and edit its config file (hope you can do this by your own).
Then for AJAX Chat :
1) edit /lib/custom.php
----------------------------------------
// Include custom libraries and initialization code here
require_once('../ipbwi/ipbwi.inc.php');
// Error Output
echo $ipbwi->printSystemMessages();
----------------------------------------
Note here that error messages will display very wrongly as they'll be printed before the <?xml tag.
2) edit /lib/class/CustomAJAXChat.php
----------------------------------------
class CustomAJAXChat extends AJAXChat {
// Initialize custom request variables:
function initCustomRequestVars() {
global $ipbwi;
// Auto-login IPB users:
if(!$this->getRequestVar('logout') && $ipbwi->member->isLoggedIn()) {
$this->setRequestVar('login', true);
}
}
// Returns true if the userID of the logged in user is identical to the userID of the authentication system
// or the user is authenticated as guest in the chat and the authentication system
/*function revalidateUserID() {
global $ipbwi;
$m_info = $ipbwi->member->info();
if($this->getUserRole() === AJAX_CHAT_GUEST && !$ipbwi->member->isLoggedIn() || ($this->getUserID() === $m_info["id"])) {
return true;
}
return false;
}*/
// Returns an associative array containing userName, userID and userRole
// Returns null if login is invalid
function getValidLoginUserData() {
global $ipbwi;
if ($ipbwi->member->isLoggedIn()) {
$m_info = $ipbwi->member->info();
$userData = array();
$userData["userID"] = $m_info["id"];
$userData["userName"] = $this->trimUserName($m_info["members_display_name"]);
if ($ipbwi->member->isAdmin()) {
$userData["userRole"] = AJAX_CHAT_ADMIN;
} elseif ($ipbwi->member->isSuperMod()) {
$userData["userRole"] = AJAX_CHAT_USER;
} else {
$userData["userRole"] = AJAX_CHAT_USER;
}
return $userData;
} else {
// Guest users
return $this->getGuestUser();
}
}
}
// Store the channels the current user has access to
// Make sure channel names don't contain any whitespace
function &getChannels() {
if($this->_channels === null) {
$this->_channels = array();
$allChannels = $this->getAllChannels();
// Get the channels, the user has access to:
if($this->getUserRole() != AJAX_CHAT_GUEST) {
$validChannels = $allChannels;
}
// Add the valid channels to the channel list (the defaultChannelID is always valid):
foreach($this->getAllChannels() as $key=>$value) {
// Check if we have to limit the available channels:
if($this->getConfig('limitChannelList') && !in_array($value, $this->getConfig('limitChannelList'))) {
continue;
}
if(in_array($value, $validChannels) || $value == $this->getConfig('defaultChannelID')) {
$this->_channels[$key] = $value;
}
}
}
return $this->_channels;
}
// Store all existing channels
// Make sure channel names don't contain any whitespace
function &getAllChannels() {
if($this->_allChannels === null) {
// Get all existing channels:
$customChannels = $this->getCustomChannels();
$defaultChannelFound = false;
foreach($customChannels as $key=>$value) {
$forumName = $this->trimChannelName($value);
$this->_allChannels[$forumName] = $key;
if($key == $this->getConfig('defaultChannelID')) {
$defaultChannelFound = true;
}
}
if(!$defaultChannelFound) {
// Add the default channel as first array element to the channel list:
$this->_allChannels = array_merge(
array(
$this->trimChannelName($this->getConfig('defaultChannelName'))=>$this->getConfig('defaultChannelID')
),
$this->_allChannels
);
}
}
return $this->_allChannels;
}
function &getCustomUsers() {
// List containing the registered chat users:
$users = null;
require(AJAX_CHAT_PATH.'lib/data/users.php');
return $users;
}
function &getCustomChannels() {
// List containing the custom channels:
$channels = null;
require(AJAX_CHAT_PATH.'lib/data/channels.php');
return $channels;
}
?>
----------------------------------------
The channel list is not working properly and I don't get ay forum list (I still use the custom channel list), but at least, the users don't have to login to AJAX Chat.
Hope it helps
Very usefull. I was able to integrate with IPB 2.3.6.
Thanks!
Oh nice.
You can still manually add channels if you can't get that working automatically. A-la wiki:
http://ajax-chat.wiki.sourceforge.net/Custom+chat+channels
so not a big deal
Thanks for posting this solution, I somehow missed it months ago!
Unfortunately for me after I followed the instructions, I simply got a bunch of error messages at the top of my chat box and the chat itself didn't work. Most of the errors seem to be variations of
Warning: Cannot modify header information - headers already sent by (output started at /home/admin/public_html/forums/chat/lib/class/CustomAJAXChat.php:132) in /home/admin/public_html/forums/chat/lib/class/AJAXChatHTTPHeader.php on line 45
while the topmost error is
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/admin/public_html/forums/chat/lib/class/CustomAJAXChat.php:132) in /home/admin/public_html/forums/chat/lib/class/AJAXChat.php on line 2471
Any idea what I may be doing wrong?
Yes. Never use notepad or word to edit php files
http://ajax-chat.wiki.sourceforge.net/Cannot+modify+header+information
can be deleted
Last edit: SamG 2013-01-20