That's why I told you to use proper intendation (TABbed)... Took me one minute to correct it and now every brace is clearly visible:
<?php
if(!defined("IN_MYBB"))
{
die("You Cannot Access This File Directly. Please Make Sure IN_MYBB Is Defined.");
}
function mystreams_info()
{
return array(
"name" => "My Streams",
"description" => "Exclusive for 1shotGG",
"website" => "http://1shotgg.com",
"author" => "Azelf",
"authorsite" => "http://1shotgg.com",
"version" => "1.0",
"guid" => "",
"compatibility" => "16*"
);
}
function mystreams_activate() {
global $db;
$mystreams_group = array(
'gid' => 'NULL',
'name' => 'mystreams',
'title' => 'My Streams',
'description' => 'Settings For My Streams',
'disporder' => "1",
'isdefault' => "0",
);
$db->insert_query('settinggroups', $mystreams_group);
$gid = $db->insert_id();
$mystreams_setting_header = array(
'sid' => 'NULL',
'name' => 'mystreams_enable_header',
'title' => 'Do you want to enable My Streams on header?',
'description' => 'If you set this option to yes, this plugin be active on your board.',
'optionscode' => 'yesno',
'value' => '1',
'disporder' => 1,
'gid' => intval($gid),
);
$db->insert_query('settings', $mystreams_setting_header);
rebuild_settings();
}
function mystreams_deactivate()
{
global $db;
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN ('mystreams_enable_header')");
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='mystreams'");
rebuild_settings();
}
$plugins->add_hook('global_end', 'mystreams_global_start');
function mystreams_global_start()
{
global $mybb, $db, $top4streams, $templates;
if ($mybb->settings['mystreams_enable_header'] == 1)
{
$result = $db->query("SELECT * FROM mybb_streams WHERE online = '1' ORDER BY votes DESC LIMIT 0, 4");
while($row = $db->fetch_array($result))
{
if ($row['online'] == 1)
{
// set variables used in the template code here:
$streamchannel = $row['channel'];
$streampreview = $row['preview'];
$stream_id = $row['userid'];
$stream_username = get_user($row['userid']);
$formatted_name = format_name($streamusername['username'], $streamusername['usergroup'], $streamusername['displaygroup']);
$desc = $row['description'];
eval("\$top4streams .= \"".$templates->get("streams_top4")."\";");
}
}
}
}
Also, as I said in my first post in this topic, which you didn't follow carefully as well:
(2014-07-02, 08:49 AM)Destroy666 Wrote: [ -> ]hook into global_start
Some templates like header are eval'd before the global_end hook so your variable would be always empty there with this code:
$plugins->add_hook('global_end', 'mystreams_global_start');
If still nothing is displayed after this change, please screen the whole streams_top4 template and location of $top4streams variable in other template. And make sure your setting is enabled and there is at least 1 online stream.