Well if your first code doesn't work, and your second code with the color changes in it works....
Then it is probably a problem with this variable: $settings['postcolourgroup']
and probably this variable as well $settings['postcolour']
Are you sure that those are the correct variables?
Like the previous poster said.... that the variables are probably $mybb->settings['postcolourgroup'] and $mybb->settings['postcolour']
So try the following code:
<?php
/**
* MyBB 1.1
* Copyright � 2005 MyBulletinBoard Group, All Rights Reserved
*
* Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html
*
* $Id: postcolour.php 661 2006-08-12 04:44am Netrosis $
*/
$plugins->add_hook("postbit", "postcolour");
function postcolour_info()
{
return array(
"name" => "Coloured Posts",
"description" => "A Plugin that will change the colour of posts for a usergroup.",
"website" => "http://www.mybboard.com",
"author" => "Netrosis",
"authorsite" => "http://www.artificialentertainment.net",
"version" => "1.0",
);
}
function postcolour_activate()
{
global $db;
$pc_group = array(
"gid" => "NULL",
"name" => "Post Colour Settings",
"description" => "Settings for the Post Colour plugin.",
"disporder" => "",
"isdefault" => "no",
);
$db->insert_query(TABLE_PREFIX."settinggroups", $pc_group);
$gid = $db->insert_id();
$pc_setting_1 = array(
"sid" => "NULL",
"name" => "postcolour",
"title" => "Colour",
"description" => "The Colour you want the post to display as",
"optionscode" => "",
"value" => "#0066CC",
"disporder" => "1",
"gid" => intval($gid),
);
$pc_setting_2 = array(
"sid" => "NULL",
"name" => "postcolourgroup",
"title" => "Usergroup",
"description" => "The usergroup number to change post colours too. Default is \"4\" (Administrators).",
"optionscode" => "",
"value" => "4",
"disporder" => "2",
"gid" => intval($gid),
);
$db->insert_query(TABLE_PREFIX."settings", $pc_setting_1);
$db->insert_query(TABLE_PREFIX."settings", $pc_setting_2);
}
function postcolour_deactivate()
{
global $db;
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN('postcolour', 'postcolourgroup')");
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='Post Colour Settings'");
}
function postcolour()
{
global $post, $settings;
if ($post['usergroup'] == $mybb->$settings['postcolourgroup'])
{
$post['message'] = '<font color="' . $mybb->$settings['postcolour'] .'">' . $post['message'] . '</font>';
}
}
?>
I don't know if it will work or not, as i did not try it. But the only difference in your code is that you changed the variables to actual values. (because it worked, that means that one of more of those two variables probably contain a null or incorrect value)