Games Section Edits - Game Section Stats
#1 21-01-2011 
This is another cool addon for mybb that doesn't have many plugins. The game section site is in a bit of a state, full of spam posts. Its a shame. anyway, I made a plugin for the stats on index and portal, but here is a core file edit that will put the existing game section set up on your index.

Open up index.php and find

PHP Code:
require_once "./global.php";

require_once 
MYBB_ROOT."inc/functions_post.php";
require_once 
MYBB_ROOT."inc/functions_forumlist.php";
require_once 
MYBB_ROOT."inc/class_parser.php";
$parser = new postParser

Then, copy the whole chunk of code in the select box below and paste it into your template - DO NOT overwrite any code, just create a new line under the block above and paste.

PHP Code:
//Requires
require_once MYBB_ROOT."inc/functions_games.php";
require_once 
MYBB_ROOT."inc/class_games.php";

$games_core = new games;

//Settings of the Game Section
$games_core->run_settings();

//Settings
if($mybb->user['uid'] != 0)
{
    
//It's not a guest, but a member, control if he has his own settings
    
if($mybb->user['games_maxgames'] == 0)
    {
        
$maxgames $games_core->settings['maxgames'];
    }
    else
    {
        
$maxgames $mybb->user['games_maxgames'];
    }
    
    if(
$mybb->user['games_maxscores'] == 0)
    {
        
$maxscores $games_core->settings['maxscores'];
    }
    else
    {
        
$maxscores $mybb->user['games_maxscores'];
    }

    if(
$mybb->user['games_sortby'] == "0" || $mybb->user['games_sortby'] == "")
    {
        
$sortby $games_core->settings['sortby'];
    }
    else
    {
        
$sortby $mybb->user['games_sortby'];
    }
    
    if(
$mybb->user['games_order'] == "0" || $mybb->user['games_order'] == "")
    {
        
$order $games_core->settings['order'];
    }
    else
    {
        
$order $mybb->user['games_order'];
    }
    
    if(
$mybb->user['games_theme'] == 0)
    {
        
$theme_games_tid $games_core->settings['theme'];
    }
    else
    {
        
$theme_games_tid $mybb->user['games_theme'];
    }
}
else
{
    
//It's a guest, load the default settings
    
$maxgames $games_core->settings['maxgames'];
    
$maxscores $games_core->settings['maxscores'];
    
$sortby $games_core->settings['sortby'];
    
$order $games_core->settings['order'];
    
$theme_games_tid $games_core->settings['theme'];
}

//Game Section Theme
$query $db->query("SELECT * FROM ".TABLE_PREFIX."games_themes WHERE tid='".$theme_games_tid."' AND active='1'");
$theme_games $db->fetch_array($query);
$theme_games_test $db->num_rows($query);

if(
$theme_games_test == 0)
{
    
//The user selected theme doesn't exist, load the default theme
    
$query $db->query("SELECT * FROM ".TABLE_PREFIX."games_themes WHERE tid='".$games_core->settings['theme']."' AND active='1'");
    
$theme_games $db->fetch_array($query);
    
$theme_games_test2 $db->num_rows($query);
}
else
{
    
$theme_games_test2 1;
}

if(
$theme_games_test2 == 0)
{
    
//The standard theme doesn't exist, load the default Game Section theme
    
$query $db->query("SELECT * FROM ".TABLE_PREFIX."games_themes WHERE tid='1'");
    
$theme_games $db->fetch_array($query);
    
$theme_games_test3 $db->num_rows($query);
}
else
{
    
$theme_games_test3 1;
}

//No theme available
if($theme_games_test3 == 0)
{
    die(
"The users selected theme, the default theme and the Game Section Default theme doesn't exist.");
}

//Templates
$templatelist "games_stats, games_stats_bestplayers, games_stats_bestplayers_bit, games_stats_champs_bit, games_stats_games_bit";

$games_core->template_cache($db->escape_string($templatelist));

//Stats
$stats_games stats(); 

Save and close index.php, and now go to your index templates in your MYBB ACP.

Add

Code:
$stats_games
wherever you want the stats table to show.
Thats it.
The site don't jive? PRESS F5 Flower

0


Sorry, that is a members only option