Edit: can a mod do me favor and change title to "Additional Staff Only Shoutbox"? as it makes another shoutbox which is staff only and leaves the original one alone
Simple hack to have a staff only shoutbox (trust me it's more simple than it looks).
Note: this is to make moderator or higher able to see/use it on a standard install with no extra user classes added.
Another note: This goes without saying but always backup the files before you edit them.
First open up a text editor and paste the following in it.
Now go into phpmyadmin (or whatever you use), select your torrenttrader database and import the file.
====================================================================
Now open config.php and find (assuming you already have shoutbox enabled):
If you wish to allow uploaders to see/use staff shoutbox change the 4 on the first line to 3 (exactly the same as i mentioned before, this number should be the same as the number mentioned earlier near top of staff_shoutbox.php).
Enjoy :(
Simple hack to have a staff only shoutbox (trust me it's more simple than it looks).
Note: this is to make moderator or higher able to see/use it on a standard install with no extra user classes added.
Another note: This goes without saying but always backup the files before you edit them.
First open up a text editor and paste the following in it.
CREATE TABLE `staff_shoutbox` (
`msgid` int(10) unsigned NOT NULL auto_increment,
`user` varchar(50) NOT NULL default '0',
`message` text,
`date` datetime NOT NULL default '0000-00-00 00:00:00',
`userid` int(8) unsigned NOT NULL default '0',
PRIMARY KEY (`msgid`),
KEY `msgid` (`msgid`)
) TYPE=MyISAM AUTO_INCREMENT=1;Save the file as staff_shoutbox.sqlNow go into phpmyadmin (or whatever you use), select your torrenttrader database and import the file.
====================================================================
Now open config.php and find (assuming you already have shoutbox enabled):
$site_config['SHOUTBOX'] = true; //enable/disable shoutboxor if shoutbox is disabled find:
$site_config['SHOUTBOX'] = false; //enable/disable shoutboxAnd just below it add:
$site_config['STAFFSHOUTBOX'] = true; //enable/disable staff shoutbox
This is so the staff shoutbox can be easily enabled or disabled in config.php separate to the user shoutbox.
====================================================================
Now make a copy of shoutbox.php and call it staff_shoutbox.php, then open it and find (right near the top):
if ($site_config['SHOUTBOX']){replace with:
if ($site_config['STAFFSHOUTBOX'] && $CURUSER["class"] > 4) {Note: To make Uploaders able to see shoutboxbox change the 4 to 3, or to make the shoutbox only useable for supermoderator or higher make it a 5 etc...
Now go find everyhere it has:
shoutbox.phpAnd replace with:
staff_shoutbox.phpNow find:
$query = "SELECT * FROM shoutbox WHERE msgid=".$_GET['del'];Replace with:
$query = "SELECT * FROM staff_shoutbox WHERE msgid=".$_GET['del'];Find:
$query = "DELETE FROM shoutbox WHERE msgid=".$_GET['del'];Replace with:
$query = "DELETE FROM staff_shoutbox WHERE msgid=".$_GET['del'];Find:
$query = "SELECT COUNT(*) FROM shoutbox WHERE message='".$shbmsg."' AND user='".$CURUSER['username']."' AND UNIX_TIMESTAMP()-UNIX_TIMESTAMP(date) < 30";Replace with:
$query = "SELECT COUNT(*) FROM staff_shoutbox WHERE message='".$shbmsg."' AND user='".$CURUSER['username']."' AND UNIX_TIMESTAMP()-UNIX_TIMESTAMP(date) < 30";Find:
$query = "INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, '".$CURUSER['username']."', '".unesc($shbmsg)."', '".get_date_time()."', '".$CURUSER['id']."')";Replace with:
$query = "INSERT INTO staff_shoutbox (msgid, user, message, date, userid) VALUES (NULL, '".$CURUSER['username']."', '".unesc($shbmsg)."', '".get_date_time()."', '".$CURUSER['id']."')";Find:
<title><?php echo $site_config['SITENAME']?>Shoutbox</title>
Replace with:
<title><?php echo $site_config['SITENAME']?>Staff Shoutbox</title>Find:
$query = 'SELECT COUNT(*) FROM shoutbox';Replace with:
$query = 'SELECT COUNT(*) FROM staff_shoutbox';Find:
$query = 'SELECT * FROM shoutbox ORDER BY msgid DESC LIMIT '.$lowerlimit.','.$upperlimit; } else { $query = 'SELECT * FROM shoutbox ORDER BY msgid DESC LIMIT 20';
Replace With:
$query = 'SELECT * FROM staff_shoutbox ORDER BY msgid DESC LIMIT '.$lowerlimit.','.$upperlimit;
}else{
$query = 'SELECT * FROM staff_shoutbox ORDER BY msgid DESC LIMIT 20';
========================================================================
Now open index.php in root directory and find:
if ($site_config['SHOUTBOX']){
begin_frame("Shoutbox");
echo '<IFRAME name="shout_frame" src="'.$site_config["SITEURL"].'/shoutbox.php" frameborder="0" marginheight="0" marginwidth="0" width="99%" height="210" width=350 scrolling="no" align="middle"></IFRAME>';
echo "(Shoutbox will auto-refresh every 5 minutes)<BR>";
end_frame();
}
Now above it (if you want staff shoutbox above shoutbox on site) or below it (if you want it below) add:
if ($site_config['STAFFSHOUTBOX'] && $CURUSER["class"] > 4){
begin_frame("Staff Shoutbox");
echo '<IFRAME name="shout_frame" src="'.$site_config["SITEURL"].'/staff_shoutbox.php" frameborder="0" marginheight="0" marginwidth="0" width="99%" height="210" width=350 scrolling="no" align="middle"></IFRAME>';
echo "(Shoutbox will auto-refresh every 5 minutes)<br>";
end_frame();
}If you wish to allow uploaders to see/use staff shoutbox change the 4 on the first line to 3 (exactly the same as i mentioned before, this number should be the same as the number mentioned earlier near top of staff_shoutbox.php).
Enjoy :(