MyBB Community Forums

Full Version: Message Bar
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

Does anyone know how to change the 'Message Bar' plugin to be at the footer of my forum?

Plugin File(msg_bar.php):
<?php
/*********************************************************************************************
+ Message Bar v0.1 : A Plugin for MyBB 1.4 and 1.6
+ Free to Use
+ Free to Edit
+ But Not Allowed to distribute
**********************************************************************************************
*/
if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

function msg_bar_info(){
	return array(
		"name"			=> "Message Bar",		"description"	=> "Allows to add important Messages on top of Site.",		"website"		=> "http://yaldaram.com",		"author"		=> "Yaldaram",		"authorsite"	=> "http://yaldaram.com",		"version"		=> "0.1",		"compatibility" => "14*,16*", "guid" => "939fc0f25b908d97b0e11ee9ac6ddb95"
	);
}
function msg_bar_activate(){
	global $db, $mybb;
	$msg_bar_group = array(
		"gid"			=> "NULL",		"name"			=> "msg_bar",		"title" 		=> "Message Bar",		"description"	=> "Settings for the plugin.",		"disporder"		=> "1",		"isdefault"		=> "no",
	);
	$db->insert_query("settinggroups", $msg_bar_group);
	$gid = $db->insert_id();
	$msg_bar_setting_1 = array(
		"sid"			=> "NULL",		"name"			=> "msg_bar_power",		"title"			=> "Power",		"description"	=> "Select Yes if you really wants this plugin to run.",		"optionscode"	=> "yesno",		"value"			=> "no",		"disporder"		=> "1",		"gid"			=> intval($gid),
	);
	$db->insert_query("settings", $msg_bar_setting_1);
	$msg_bar_setting_2 = array(
		"sid"			=> "NULL",		"name"			=> "msg_bar_groups",		"title"			=> "Allowed_Group",		"description"	=> "Specify who can see Message Bar. Separate each with ,",		"optionscode"	=> "text",		"value"			=> "2,3,4,6,8",		"disporder"		=> "2",		"gid"			=> intval($gid),
	);
	$db->insert_query("settings", $msg_bar_setting_2);
	$msg_bar_setting_3 = array(
		"sid"			=> "NULL",		"name"			=> "msg_bar_back",		"title"			=> "Background_Color",		"description"	=> "What color you like to use as Background ?",		"optionscode"	=> "text",		"value"			=> "#99CCFF",		"disporder"		=> "3",		"gid"			=> intval($gid),
	);
	$db->insert_query("settings", $msg_bar_setting_3);
	$msg_bar_setting_4 = array(
		"sid"			=> "NULL",
		"name"			=> "msg_bar_scroll",		"title"			=> "Scrolling",		"description"	=> "Do you want Messages to scroll ?",		"optionscode"	=> "yesno",		"value"			=> "yes",		"disporder"		=> "4",		"gid"			=> intval($gid),
	);
	$db->insert_query("settings", $msg_bar_setting_4);
	$msg_bar_setting_5 = array(
		"sid"			=> "NULL",		"name"			=> "msg_bar_msg",		"title"			=> "Messages",		"description"	=> "Enter your messages here. (HTML allowed)",		"optionscode"	=> "textarea",		"value"			=> "Test message...",		"disporder"		=> "5",		"gid"			=> intval($gid),
	);
	$db->insert_query("settings", $msg_bar_setting_5);
    rebuild_settings();
}
function msg_bar_deactivate(){
	global $db, $mybb;
	$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='msg_bar'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='msg_bar_power'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='msg_bar_groups'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='msg_bar_back'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='msg_bar_scroll'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='msg_bar_msg'");
    rebuild_settings();
}
$plugins->add_hook("pre_output_page", "msg_bar");
function msg_bar($page){
	global $mybb, $groupscache;
	$power = $mybb->settings['msg_bar_power'];
	$group = $mybb->user['usergroup'];
	$groups = explode(",",$mybb->settings['msg_bar_groups']);
	$backcol = $mybb->settings['msg_bar_back'];
	$msg = $mybb->settings['msg_bar_msg'];
	if ($mybb->settings['msg_bar_scroll'] == "1"){
		$scroll = '<marquee behavior="scroll" direction="left" scrollamount="5" scrolldelay="2" onmouseover="this.stop();" onmouseout="this.start();" />';
	}
	else{
		$scroll = '';
	}
	if ($power != "0")	{
		if (in_array($group,$groups)){
			$page = str_replace("<div id=\"content\">", "
<div id=\"content\"><table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#0000FF\" width=\"100%\" bgcolor=\"$backcol\"><tr><td width=\"100%\" valign=\"top\"><font size=\"1\" color=\"#000000\">
$scroll
$msg
</marquee></font></td></tr></table>", $page);
	return $page;
		}
	}
}
?>
Can you please post your forum's URL ?
affectionhost.info/forum
Thank You.

Deactivate the plugin, then Replace all code of the plugin with this;
<?php
/********************************************************************************​*************
+ Message Bar v0.1 : A Plugin for MyBB 1.4 and 1.6
+ Free to Use
+ Free to Edit
+ But Not Allowed to distribute
********************************************************************************​**************
*/
if(!defined("IN_MYBB"))
{
    die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

function msg_bar_info(){
    return array(
        "name"            => "Message Bar",        "description"    => "Allows to add important Messages on top of Site.",        "website"        => "http://yaldaram.com",        "author"        => "Yaldaram",        "authorsite"    => "http://yaldaram.com",        "version"        => "0.1",        "compatibility" => "14*,16*", "guid" => "939fc0f25b908d97b0e11ee9ac6ddb95"
    );
}
function msg_bar_activate(){
    global $db, $mybb;
    $msg_bar_group = array(
        "gid"            => "NULL",        "name"            => "msg_bar",        "title"         => "Message Bar",        "description"    => "Settings for the plugin.",        "disporder"        => "1",        "isdefault"        => "no",
    );
    $db->insert_query("settinggroups", $msg_bar_group);
    $gid = $db->insert_id();
    $msg_bar_setting_1 = array(
        "sid"            => "NULL",        "name"            => "msg_bar_power",        "title"            => "Power",        "description"    => "Select Yes if you really wants this plugin to run.",        "optionscode"    => "yesno",        "value"            => "no",        "disporder"        => "1",        "gid"            => intval($gid),
    );
    $db->insert_query("settings", $msg_bar_setting_1);
    $msg_bar_setting_2 = array(
        "sid"            => "NULL",        "name"            => "msg_bar_groups",        "title"            => "Allowed_Group",        "description"    => "Specify who can see Message Bar. Separate each with ,",        "optionscode"    => "text",        "value"            => "2,3,4,6,8",        "disporder"        => "2",        "gid"            => intval($gid),
    );
    $db->insert_query("settings", $msg_bar_setting_2);
    $msg_bar_setting_3 = array(
        "sid"            => "NULL",        "name"            => "msg_bar_back",        "title"            => "Background_Color",        "description"    => "What color you like to use as Background ?",        "optionscode"    => "text",        "value"            => "#99CCFF",        "disporder"        => "3",        "gid"            => intval($gid),
    );
    $db->insert_query("settings", $msg_bar_setting_3);
    $msg_bar_setting_4 = array(
        "sid"            => "NULL",
        "name"            => "msg_bar_scroll",        "title"            => "Scrolling",        "description"    => "Do you want Messages to scroll ?",        "optionscode"    => "yesno",        "value"            => "yes",        "disporder"        => "4",        "gid"            => intval($gid),
    );
    $db->insert_query("settings", $msg_bar_setting_4);
    $msg_bar_setting_5 = array(
        "sid"            => "NULL",        "name"            => "msg_bar_msg",        "title"            => "Messages",        "description"    => "Enter your messages here. (HTML allowed)",        "optionscode"    => "textarea",        "value"            => "Test message...",        "disporder"        => "5",        "gid"            => intval($gid),
    );
    $db->insert_query("settings", $msg_bar_setting_5);
    rebuild_settings();
}
function msg_bar_deactivate(){
    global $db, $mybb;
    $db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='msg_bar'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='msg_bar_power'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='msg_bar_groups'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='msg_bar_back'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='msg_bar_scroll'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='msg_bar_msg'");
    rebuild_settings();
}
$plugins->add_hook("pre_output_page", "msg_bar");
function msg_bar($page){
    global $mybb, $groupscache;
    $power = $mybb->settings['msg_bar_power'];
    $group = $mybb->user['usergroup'];
    $groups = explode(",",$mybb->settings['msg_bar_groups']);
    $backcol = $mybb->settings['msg_bar_back'];
    $msg = $mybb->settings['msg_bar_msg'];
    if ($mybb->settings['msg_bar_scroll'] == "1"){
        $scroll = '<marquee behavior="scroll" direction="left" scrollamount="5" scrolldelay="2" onmouseover="this.stop();" onmouseout="this.start();" />';
    }
    else{
        $scroll = '';
    }
    if ($power != "0")    {
        if (in_array($group,$groups)){
            $page = str_replace("<div class=\"bottommenu\">", "
<div class=\"bottommenu\"><table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#0000FF\" width=\"100%\" bgcolor=\"$backcol\"><tr><td width=\"100%\" valign=\"top\"><font size=\"1\" color=\"#000000\">
$scroll
$msg
</marquee></font></td></tr></table>", $page);
    return $page;
        }
    }
}
?>

Re-activate the plugin again. Hopefully it should work.
Worked. Thanks ^.^