Disclaimer:
-----------
I, the author of these instructions take no responsibility for anything which may happen as a result of editing or changing any original files.
Sye

These instructions presume you have already installed and have working Shoutbox 2.0 mod created by MusicalMidget.

Always make sure you create a backup of any files you are changing in case something goes horrible wrong

Contents




Installing the Shoutbox on the index page

Navigate to Template Management > Expand Template > Index Page Templates > Index

Find

{$header}


Add below
<iframe src="http://www.yourdomain/mybb/shoutbox.php" width="99%" height="150" scrolling="yes" class="tborder" frameborder="0"></iframe>

Save the template and return to your forum index page, refresh your forums

Once completed successfully you will most likely want to have the textbox you shout in to display underneath the Shoutbox, as at present you will need to scroll down inside the new frame we created.
Continue to the next step to achieve this


Separating textbox from the Shoutbox

Navigate to Template Management > Expand Template > Index Page Templates > Index

Find

<iframe src="http://www.yourdomain/mybb/shoutbox.php" width="99%" height="150" scrolling="yes" class="tborder" frameborder="0"></iframe>


Add below
<form method="post" action="shoutbox.php">
<input type="hidden" name="action" value="do_add">
<table border="0" cellspacing="1" cellpadding="4" class="tborder">
<tr>
<td class="trow1" align="center">
<strong>Shout:</strong>
<input type="text" name="message" size="40" maxlength="500">
<input type="submit" name="submit" value="Add Shout">
<br />
</td>
</tr>
</form>

Save your template and return to your forums, refresh the page.

Do NOT try to post anything yet as you will redirect the index page to the Shoutbox page.

With a FTP program open www > mybb > shoutbox.php

Find (use the find option in notepad and search for redirect)

$db->insert_query(TABLE_PREFIX.'shouts', $new_shout);
redirect('shoutbox.php', $lang->redirect_shout_added);
break;
case 'do_delete':
if($mybb->input['deletesubmit'])
{
if(intval($mybb->input['sid']))

Replace with

$db->insert_query(TABLE_PREFIX.'shouts', $new_shout);
redirect('index.php', $lang->redirect_shout_added);
break;
case 'do_delete':
if($mybb->input['deletesubmit'])
{
if(intval($mybb->input['sid']))

You are only changing the redirect page from shoutbox.php to index.php. This will cause the Shoutbox to refresh and let the user stay on the index page.

If you wish to reverse the Shoutbox display order stay in the shoutbox.php file and continue to the next step



Reversing the Shoutbox display

With a FTP program open www > mybb > shoutbox.php

Find

// Start getting shouts!
$query = $db->query("
SELECT s.*, s.username AS shout_username, u.username, u.usergroup, u.displaygroup
FROM ".TABLE_PREFIX."shouts s
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=s.uid)
ORDER BY s.dateline
LIMIT $start, $limit
");

Replace with

// Start getting shouts!
$query = $db->query("
SELECT s.*, s.username AS shout_username, u.username, u.usergroup, u.displaygroup
FROM ".TABLE_PREFIX."shouts s
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=s.uid)
ORDER BY s.dateline desc
LIMIT $start, $limit
");

Note: You are only adding 'desc' to the ORDER BY line.

Save the file making sure you DO NOT change anything else. Refresh your home page and if done correctly the shoutbox will be reversed.

At present when you obtain several shouts and two pages is need the latest shout will appear on the second page, causing a problem seeing the last shout made. The only temporary fix at the moment is to go into your shoutbox settings and change the max number of shouts per page to a high amount. Then routinely log into your MySql database and delete the older shouts.




Displaying the Date and Time

This process is a bit more tricky, so follow the instructions carefully

With a FTP program open www > mybb > shoutbox.php

Find and cut the text out. Highlight the text and either right click and select cut or use ctrl + x on the keyboard

// Prepare hover message
$shout['date'] = my_date($mybb->settings['dateformat'], $shout['dateline']);
$shout['time'] = my_date($mybb->settings['timeformat'], $shout['dateline']);

$shout['ip'] = '';
if($mybb->user['usergroup'] == 3 || $mybb->user['usergroup'] == 4)
{
$shout['ip'] = sprintf($lang->shout_hover_ip, $shout['ipaddress']);
}

$title = sprintf($lang->shout_hover, $shout['date'], $shout['time'], $shout['ip']);

Find

// Check for /me and /slap tags in shout and adjust username displying accordingly.
$mecheck = explode(' ', $shout['message']);
if($mecheck[0] == '/me' || $mecheck[0] == '/slap')
{
$shout['username'] = '';
}

Insert the text you cut out, so it looks like this

// Prepare hover message
$shout['date'] = my_date($mybb->settings['dateformat'], $shout['dateline']);
$shout['time'] = my_date($mybb->settings['timeformat'], $shout['dateline']);

$shout['ip'] = '';
if($mybb->user['usergroup'] == 3 || $mybb->user['usergroup'] == 4)
{
$shout['ip'] = sprintf($lang->shout_hover_ip, $shout['ipaddress']);
}

$title = sprintf($lang->shout_hover, $shout['date'], $shout['time'], $shout['ip']);


// Check for /me and /slap tags in shout and adjust username displying accordingly.
$mecheck = explode(' ', $shout['message']);
if($mecheck[0] == '/me' || $mecheck[0] == '/slap')
{
$shout['username'] = '';
}

Now find

if($shout['uid'] > 0)
{
$shout['username'] = format_name($shout['username'], $shout['usergroup'], $shout['displaygroup']);
$shout['username'] = '<< a href="member.php?action=profile&uid='.intval($shout['uid']).'">'.$shout['username'].'</a>> ';
}
else
{
$shout['username'] = '<'.$lang->guest.'> ';
}

And replace with the following

if($shout['uid'] > 0)
{
$shout['username'] = format_name($shout['username'], $shout['usergroup'], $shout['displaygroup']);
$shout['username'] = '['.$shout['date'].' '.$shout['time'].'] <a href="member.php?action=profile&uid='.intval($shout['uid']).'">'.$shout['username'].'</a> - &nbsp;';
}
else
{
$shout['username'] = '<'.$lang->guest.'> ';
}

Save the file making sure you DO NOT change anything else, and refresh your forum index page. You should now see the date and time displayed before each shout.





Firefox compatibilty

Forum controls > Template Manager > Global Templates

Scroll down to Shoutbox_shout and click edit

Replace

<tr> <td align="left"><small>{$shout['username']}<b>{$shout['message']}{$options}</b></small></td> </tr>

With

<tr> <td align="left"><small>{$shout['username']}<b>{$shout['message']}{$options}</b></small><br></td> </tr>




Removing horizontal lines

Only do this if you have installed the shoutbox onto your index page as it will remove the textbox at the bottom of the shoutbox page

Forum controls > Template Manager > Global Templates

Scroll down to Shoutbox and click edit

Replace your template with

<html>
<head>
<title>{$mybb->settings['bbname']} - {$lang->shoutbox}</title>
{$headerinclude}
{$refresh}
</head>
<body>
<table border="0" cellspacing="1" cellpadding="0" width="99%">
<tr>
</tr>
{$multipage_top}
{$shouts}
</table>

</body>
</html>

Open Shoutbox_shout and replace your template with

<tr>
<td align="left"><small>{$shout['username']}<b>{$shout['message']}{$options}</b></small><br></td>
</tr>