MyBB Community Forums

Full Version: AJAX Chat - including MyBB integration
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
Use's the same DB you have for the forums, yes they log into the forums to use the chat
I finally got this working on my test forum - special thanks to dpdurst. However, I found an odd thing - if I log in via the forum, then the user name in the chat is the username on the forum. If I log in direct it seems to be using my IP address. Has anyone else encountered this and if so, was it fixable?
I like this but I was wondering how the heck do you make this a shoutbox for MyBB, I thought this was possible?
(2010-01-27, 01:27 PM)Cyber_Punk Wrote: [ -> ]I like this but I was wondering how the heck do you make this a shoutbox for MyBB, I thought this was possible?

At the bottom of the instructions included in the zip is the instructions on how to setup the shoutbox.
(2010-01-27, 01:39 PM)dpdurst Wrote: [ -> ]
(2010-01-27, 01:27 PM)Cyber_Punk Wrote: [ -> ]I like this but I was wondering how the heck do you make this a shoutbox for MyBB, I thought this was possible?

At the bottom of the instructions included in the zip is the instructions on how to setup the shoutbox.

Hmm, I had tried that but it didn't work. I was sort of confused on where to add the function to read from the chat, I had put it in my functions.php I suppose I will have to try again.
Yea I never setup the shoutbox from Ajax Chat, I went with another one and modified it.
I'm not sure if this info is already in the thread, but here is how to change the chat name

Hi,

There are a number of ways you can change the heading (or page title).

If you want to keep the translation, then edit the value of $lang['title'] in each language file in lib/lang.

If you want a fixed value, and you're not concerned about translation, then replace (in loggedIn.html and loggedOut.html):

<h1>[LANG]title[/LANG]</h1>

With:

<h1>My fixed title</h1>

Lastly, if you want a dynamic value, and you're not concerned about translation, then replace (in loggedIn.html and loggedOut.html):

<h1>[LANG]title[/LANG]</h1>

With:

<h1>[TITLE/]</h1>

And add the following code in your CustomAJAXChat class:

public function replaceCustomTemplateTags($tag, $tagContent)
{
switch ($tag) {
case 'TITLE':
return 'Welcome ' . $this->name . '!'; // Example (you need to make $this->name available)
default:
return null;
}
}

Thanks to source forge user DodgerLD
(2009-11-20, 03:58 PM)ows Wrote: [ -> ]First of all ... install and activate this plugin to enable php-code in templates.

I made all from THIS instruction, but I haven't got my ShoutBox. Only inscription " Shoutbox" -->Screen:
[Image: 90597851166486987514_thumb.png]
Could you tell me how to install and activate this plugin ?
I only sent it to the root folder on the FTP. I'm new in MyBB :/
Please help me.
Screw this plugin, I uploaded all the files but then decided to remove it because it was taking to long and too make a long story short now I gonna have to restore from a week old backup.

Not impressed.
(2009-11-20, 03:58 PM)ows Wrote: [ -> ]
(2009-07-10, 09:31 PM)ecanikajo Wrote: [ -> ]I would like to insert the Ajax chat on the index page as Shoutbox.

(2009-07-29, 11:41 PM)gimmezell Wrote: [ -> ]I'm interested in using this as a shoutbox too.

First of all ... install and activate this plugin to enable php-code in templates.

Open your themes "global.css" in advanced mode and add this code on top:

@import url("./chat/css/shoutbox.css");

Create a new file with this code:

<?php
function getShoutBoxContent() {
	// URL to the chat directory:
	if(!defined('AJAX_CHAT_URL')) {
		define('AJAX_CHAT_URL', './chat/');
	}
	
	// Path to the chat directory:
	if(!defined('AJAX_CHAT_PATH')) {
		define('AJAX_CHAT_PATH', realpath(dirname($_SERVER['SCRIPT_FILENAME']).'/chat').'/');
	}
	
	// Validate the path to the chat:
	if(@is_file(AJAX_CHAT_PATH.'lib/classes.php')) {
		
		// Include Class libraries:
		require_once(AJAX_CHAT_PATH.'lib/classes.php');
		
		// Initialize the shoutbox:
		$ajaxChat = new CustomAJAXChatShoutBox();
		
		// Parse and return the shoutbox template content:
		return $ajaxChat->getShoutBoxContent();
	}
	
	return null;
}
?>

and save it as "shoutbox.php" in your forums root directory.

Edit your MyBB-Forums "index.php", search for (~line 27)

// Load global language phrases
$lang->load("index");

AFTER add:

// START Shoutbox-Code
ob_start();
include("shoutbox.php");
$shoutbox = ob_get_contents();
ob_end_clean();
// END Shoutbox-Code

Edit your themes template "Index Page Templates --> index". Search for

{$header}

AFTER add:

<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" width="100%" class="tborder">
<thead>
<tr>
<td class="thead">
<div class="expcolimage">
<img src="{$theme['imgdir']}/collapse{$collapsedimg['shoutbox']}.gif" id="shoutbox_img" class="expander" alt="[-]" title="[-]" />
</div>
<div><strong>Shoutbox</strong></div>
</td>
</tr>
</thead>
<tbody style="{$collapsed['shoutbox_e']}" id="shoutbox_e">
<tr>
<td class="trow1"><div style="width:100%;"><?php echo getShoutBoxContent(); ?></div></td>
</tr>
</tbody>
</table>
<br />

Youre done Wink

Demo-Link (sorry, german only)

Nothing happens?

1. Check the path to your chat-directory in "global.css" and "shoutbox.php" (lines 5 and 10)!

2. Activate Output template start/end comments? in Admin-CP --> Configuration --> Settings --> Server and Optimization Options

Thanks very much for this, it works a treat. I was pulling my hair out trying to figure out how to make it a shoutbox.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38