vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Add-On Releases - v3 Arcade Stats Widget or Forum Sideblock (https://vborg.vbsupport.ru/showthread.php?t=261177)

Gemma 03-29-2011 10:00 PM

v3 Arcade Stats Widget or Forum Sideblock
 
1 Attachment(s)
What is it?

A widget for users of vB4 Suite (should work with any version of vB 4) and v3 Arcade 2.0.x who want to show some arcade data on their CMS. This is basically the same as the vBadvanced CMPS module KW802 made, all I've done is adapt it for the Suite.

The Widget shows:
Latest Scores, Latest Highscore, Newest X Games, Most Played Games, Most Popular X Games (Rated), Random Game, Top Champions

How To Install

1. Download the attached product file and install it, upload the images to images/arcade.
2. Create New Widget

ADMIN CP > vBulletin CMS > Widgets > Create New Widget
Widget Type: PHP Direct Execution
Title: Arcade Statistics
Description: Widget To Display Arcade Stats On CMS.

Configure The Widget

Paste the following code into the box

Code:

global $vbulletin, $bbcode, $parser, $path, $db;
$g_limit = 5;
$g_champs_limit = 5;
$g_news_limit = 5;
$g_scores_limit = 5;

function get_games ($as_handle, $as_title, $limit) {
    global $vbulletin;

    switch ($as_handle) {
        case 'recent':
            $orderby = "dateadded DESC";
            break;
        case 'played':
            $orderby = "sessioncount DESC";
            break;
        case 'popular':
            $orderby = "votepoints DESC";
            break;
        default:
            $orderby = "gameid ASC";
            break;
    }


    $getgames = $vbulletin->db->query("
            SELECT games.* FROM " . TABLE_PREFIX . "v3arcade_games AS games
            ORDER BY " . $orderby . "
            LIMIT $limit
    ");

    while ($game = $vbulletin->db->fetch_array($getgames))
    {
            $game['gamename'] = fetch_trimmed_title(stripslashes($game['title']),$maxtitlechars);
            $game['gamedate'] = vbdate($vbulletin->options['dateformat'], $game['dateadded']);
            $getbgrow = exec_switch_bg();

        switch ($as_handle) {
            case 'recent':
                $as_game_data = $game['gamedate'];
                break;
            case 'played':
                $as_game_data = "Played " . $game['sessioncount'] . " times";
                break;
            case 'popular':
                $as_game_data = $game['votepoints'] . " votes";
                break;
            default:
                $as_game_data = "";
                break;
        }

            //eval('$as_gamebits .= "' . fetch_template('v3a_CMS_as_gamebits') . '";');
            $templater = vB_Template::create('v3a_CMS_as_gamebits');
        $templater->register('as_game_data',$as_game_data);
          $templater->register('game',$game);
          $as_gamebits .= $templater->render();

    }
    $vbulletin->db->free_result($getgames);

    // eval('$gametable = "' . fetch_template("v3a_CMS_as_{$as_handle}_gametable") . '";');
    $templater = vB_Template::create('v3a_CMS_as_' . $as_handle . '_gametable');
    $templater->register('as_title',$as_title);
    $templater->register('as_gamebits',$as_gamebits);
    $gametable = $templater->render();
    return $gametable;
}

function get_champs ($limit) {
    global $vbulletin;

    $champs = $vbulletin->db->query_read("
            SELECT COUNT(games.highscorerid) AS count, user.username, user.userid
        FROM " . TABLE_PREFIX . "v3arcade_games AS games
            LEFT JOIN " . TABLE_PREFIX . "user AS user ON user.userid = games.highscorerid
            WHERE user.userid IS NOT NULL
            GROUP BY user.username, user.userid
        ORDER BY count DESC, user.userid ASC
        LIMIT " . $limit
    );

    $row = '0';
    $awards = '0';
    $leaders = '0';
    while ($champ = $vbulletin->db->fetch_array($champs)) {
        $leaders++;
        if ($awards != $champ['count']) {
            $row = $leaders;
        }
        $awards = $champ['count'];
        $getbgrow = exec_switch_bg();
        //eval('$as_champbits .= "' . fetch_template('v3a_CMS_as_champbits') . '";');
        $templater = vB_Template::create('v3a_CMS_as_champbits');
        $templater->register('getbrow',$getbrow);
          $templater->register('champ',$champ);
          $as_champbits .= $templater->render();
    }
    $vbulletin->db->free_result($champs);

    //eval('$champstable = "' . fetch_template("v3a_CMS_as_champstable") . '";');
    $templater = vB_Template::create('v3a_CMS_as_champstable');
    $templater->register('as_champbits',$as_champbits);
    $champstable = $templater->render();
    return $champstable;
}

function get_random_game () {
    global $vbulletin;

    $random_game = $vbulletin->db->query_first("
        SELECT gameid,title,description,stdimage,highscore,user.userid,user.username
        FROM " . TABLE_PREFIX . "v3arcade_games AS games
            LEFT JOIN " . TABLE_PREFIX . "user AS user ON user.userid = games.highscorerid
        ORDER BY RAND()
        LIMIT 1
    ");

    $as_random_gameid = $random_game[gameid];
        $as_random_gametitle = $random_game[title];
        $as_random_stdimage = $random_game[stdimage];
        $as_random_description = $random_game[description];
    if($random_game[highscore] == 0)
    {
        $as_random_highscore    = "No Score";
        $as_random_highscorer    = "";
        $as_random_userid    = "";
    }
    else
    {
        $as_random_highscore    = intval($random_game[highscore]);
        $as_random_highscorer    = "(" . $random_game[username] . ")";
        $as_random_userid    = $random_game[userid];
    }
    $vbulletin->db->free_result($random_game);
    //eval('$random_table = "' . fetch_template('v3a_CMS_as_random') . '";');
    $templater = vB_Template::create('v3a_CMS_as_random');
    $templater->register('as_random_gameid',$as_random_gameid);
    $templater->register('as_random_gametitle',$as_random_gametitle);
    $templater->register('as_random_highscore',$as_random_highscore);
    $templater->register('as_random_userid',$as_random_userid);
    $templater->register('as_random_highscorer',$as_random_highscorer);
    $templater->register('as_random_stdimage',$as_random_stdimage);
    $templater->register('as_random_description',$as_random_description);
    $random_table = $templater->render();
    return $random_table;
}

function get_latest_champs ($limit)
{
    global $vbulletin, $bbcode_parser;

    //var_dump($vbulletin);
    //highlight_file('./modules/arcadestats.php');
    //exit;
    $news_items = $vbulletin->db->query_read("
        SELECT *
        FROM " . TABLE_PREFIX . "v3arcade_news
        WHERE newstext LIKE '%is the new%'
        ORDER BY datestamp DESC
        LIMIT $limit
    ");

    while ($news_item = $vbulletin->db->fetch_array($news_items)) {
          //$as_news_text =  $bbcode_parser->do_parse($news_item['newstext'], 1, 1, 1, 0);
        $as_news_text = $news_item['newstext'];
        $as_news_text = str_replace("arcade.php", $vbulletin->options['bburl'] . "/arcade.php", $as_news_text);

        $as_news_date = vbdate($vbulletin->options['dateformat'],$news_item['datestamp']);
        $as_news_time = vbdate($vbulletin->options['timeformat'],$news_item['datestamp']);
        $getbgrow = exec_switch_bg();
        //eval('$as_newsbits .= "' . fetch_template('v3a_CMS_as_newsbits') . '";');
        $templater = vB_Template::create('v3a_CMS_as_newsbits');
          $templater->register('getbrow',$getbrow);
          $templater->register('as_news_text',$as_news_text);
          $templater->register('as_news_date',$as_news_date);
          $templater->register('as_news_time',$as_news_time);
          $as_newsbits .= $templater->render();

    }
    $vbulletin->db->free_result($news_items);

    //eval('$news_table = "' . fetch_template('v3a_CMS_as_newstable') . '";');
    $templater = vB_Template::create('v3a_CMS_as_newstable');
    $templater->register('as_newsbits',$as_newsbits);
    $news_table = $templater->render();
    return $news_table;
}

function get_latest_scores ($limit)
{
    global $vbulletin;

    $latest_scores = $vbulletin->db->query_read("
        SELECT sessions.userid, sessions.gamename, sessions.gameid, sessions.score, sessions.start, sessions.finish,
            user.username,
            games.title
        FROM " . TABLE_PREFIX . "v3arcade_sessions as sessions
        LEFT JOIN " . TABLE_PREFIX . "user AS user
            ON (sessions.userid = user.userid)
        LEFT JOIN " . TABLE_PREFIX . "v3arcade_games as games
            on (sessions.gameid = games.gameid)
        WHERE valid = 1
            AND tourid = 0
            AND challengeid = 0
        ORDER BY  sessions.sessionid DESC
        LIMIT $limit
    ");

    while ($latest_score = $vbulletin->db->fetch_array($latest_scores)) {
        $as_score_userid = $latest_score['userid'];
        $as_score_gameid = $latest_score['gameid'];
        $as_score_name = $latest_score['username'];
        $as_score_score = floatval($latest_score['score']);
        $as_score_gametitle = $latest_score['title'];
        $as_score_date = vbdate($vbulletin->options['dateformat'],$latest_score['finish']);
        $as_score_time = vbdate($vbulletin->options['timeformat'],$latest_score['finish']);
        //echo "foo: $as_score_gametitle<br>\n";
        $getbgrow = exec_switch_bg();
        //eval('$as_scorebits .= "' . fetch_template('v3a_CMS_as_scorebits') . '";');
        $templater = vB_Template::create('v3a_CMS_as_scorebits');
          $templater->register('getbrow',$getbrow);
          $templater->register('as_score_userid',$as_score_userid);
          $templater->register('as_score_name',$as_score_name);
          $templater->register('as_score_score',$as_score_score);
          $templater->register('as_score_gameid',$as_score_gameid);
          $templater->register('as_score_gametitle',$as_score_gametitle);
          $templater->register('as_score_date',$as_score_date);
          $templater->register('as_score_time',$as_score_time);
          $as_scorebits .= $templater->render();
    }
    $vbulletin->db->free_result($latest_scores);

    //eval('$score_table = "' . fetch_template('v3a_CMS_as_scoretable') . '";');
    $templater = vB_Template::create('v3a_CMS_as_scoretable');
    $templater->register('as_scorebits',$as_scorebits);
    $score_table = $templater->render();
    return $score_table;
}

$as_score_table = get_latest_scores($g_scores_limit);
$as_news_table = get_latest_champs($g_news_limit);
$as_random_table = get_random_game();
$as_champs_table = get_champs($g_champs_limit);
$as_recent_table = get_games("recent","Most Recent", $g_limit);
$as_played_table = get_games("played","Most Played", $g_limit);
$as_popular_table = get_games("popular","Most Popular", $g_limit);

$collapseobj_arcadestats = $vbcollapse['collapseobj_arcadestats'];
$collapseimg_arcadestats = $vbcollapse['collapseimg_arcadestats'];

//eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('v3a_CMS_arcadestats') . '";');
$templater = vB_Template::create('v3a_CMS_arcadestats');
$templater->register('as_score_table',$as_score_table);
$templater->register('as_news_table',$as_news_table);
$templater->register('as_random_table',$as_random_table);
$templater->register('as_champs_table',$as_champs_table);
$templater->register('as_recent_table',$as_recent_table);
$templater->register('as_played_table',$as_played_table);
$templater->register('as_popular_table',$as_popular_table);
$output = $templater->render();

Add Widget to a Page

ADMIN CP > vBulletin CMS > Layout manager > Edit
Insert the Welcome widget and place it central

You can also change the amount of data display by adjust these values

Code:

$g_limit = 5;
$g_champs_limit = 5;
$g_news_limit = 5;
$g_scores_limit = 5;

And/or remove certain blocks from the stats by commenting out the relevent code from this section (see attached image for adjusted look)
Code:

$templater->register('as_score_table',$as_score_table);
$templater->register('as_news_table',$as_news_table);
$templater->register('as_random_table',$as_random_table);
$templater->register('as_champs_table',$as_champs_table);
$templater->register('as_recent_table',$as_recent_table);
$templater->register('as_played_table',$as_played_table);
$templater->register('as_popular_table',$as_popular_table);

History
4.0.8 - Initial release on vB.org
4.0.9 - Added images to the header titles
4.1 - Minor change to Champs block
4.1.1 - bug fix regarding tournament scores
4.1.2 - removed challenge scores from appearing in latest score block.
4.1.3 - Linked Latest Scores and Top Champs username to Member Profile Arcade Tab

How To Make Into A Forum Sideblock - https://vborg.vbsupport.ru/showpost....9&postcount=11

Finally, I'm blonde and never done anything like this before, so now you're warned......use at your own risk :eek:

For vBAdvanced Module - http://www.v3arcade.com/forums/showthread.php?t=3502

If anyone wants to further develop any of my addons, you are free to do so.

VBIran 04-01-2011 04:20 PM

No Files Uploaded.

Gemma 04-01-2011 04:23 PM

Sorry I was updating it.

Version 4.0.9

Someone asked me for the little images beside the block titles, I've uploaded the images and updated the product accordingly. To re-upgrade, upload the images to your images/arcade folder and re-install the product.

8thos 04-01-2011 05:06 PM

Hmmm I'm going to try this. I saw it on your site and thought it was awesome.

doctorsexy 04-16-2011 02:53 PM

Works smashin with 4.1.2....Thanks

Gemma 04-16-2011 09:53 PM

Quote:

Originally Posted by doctorsexy (Post 2185290)
Works smashin with 4.1.2....Thanks

Remember click installed so you can get notification of future updates ;)

doctorsexy 04-20-2011 05:55 PM

Working with 4.1.3 as well

MGP_Tech 05-13-2011 02:04 PM

5 stars :) Thank you!

vvdven 08-12-2011 03:35 PM

Thanks, i've been looking for something like this for a while.

Oddly enough, I get a error:

Code:

Parse error: syntax error, unexpected ';', expecting T_PAAMAYIM_NEKUDOTAYIM in /home/username/domains/domain.com/public_html/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 12
I am on VB 4.1.5 Patch Level 1 and VBSEO.

Thanks.

GamersChallenge 08-20-2011 07:16 PM

love it. works fine on 4.1.5.

Gemma do you think you can creat the same type of widget for this mod: https://vborg.vbsupport.ru/showthrea...hlight=ladders

maybe for a price? let me know.

Gemma 09-14-2011 08:29 PM

1 Attachment(s)
I've also been able to use almost all the same templates and php code to make a forum sideblock.

1. Install the product as normal.

2. Create a new template called v3a_CMS_arcadestats1 and add the following code
Code:

<div>
<table align="left" width="100%">
  <tr><td>{vb:raw as_score_table}</td></tr>
  <tr><td>{vb:raw as_news_table}</td></tr>
  <tr><td>{vb:raw as_random_table}</td></tr>
  <tr><td>{vb:raw as_champs_table}</td></tr>
  <tr><td>{vb:raw as_recent_table}</td></tr>
  <tr><td>{vb:raw as_played_table}</td></tr>
  <tr><td>{vb:raw as_popular_table}</td></tr>
</table>
</div>

3. Go to AdminCP > Forums & Moderators > Forum Block Manager > Add Block
Title - Arcade Stats (or whatever)
Content Type - PHP
Content -
Code:

global $vbulletin, $bbcode, $parser, $path, $db;
$g_limit = 5;
$g_champs_limit = 5;
$g_news_limit = 5;
$g_scores_limit = 5;

function get_games ($as_handle, $as_title, $limit) {
    global $vbulletin;

    switch ($as_handle) {
        case 'recent':
            $orderby = "dateadded DESC";
            break;
        case 'played':
            $orderby = "sessioncount DESC";
            break;
        case 'popular':
            $orderby = "votepoints DESC";
            break;
        default:
            $orderby = "gameid ASC";
            break;
    }


    $getgames = $vbulletin->db->query("
            SELECT games.* FROM " . TABLE_PREFIX . "v3arcade_games AS games
            ORDER BY " . $orderby . "
            LIMIT $limit
    ");

    while ($game = $vbulletin->db->fetch_array($getgames))
    {
            $game['gamename'] = fetch_trimmed_title(stripslashes($game['title']),$maxtitlechars);
            $game['gamedate'] = vbdate($vbulletin->options['dateformat'], $game['dateadded']);
            $getbgrow = exec_switch_bg();

        switch ($as_handle) {
            case 'recent':
                $as_game_data = $game['gamedate'];
                break;
            case 'played':
                $as_game_data = "Played " . $game['sessioncount'] . " times";
                break;
            case 'popular':
                $as_game_data = $game['votepoints'] . " votes";
                break;
            default:
                $as_game_data = "";
                break;
        }

            //eval('$as_gamebits .= "' . fetch_template('v3a_CMS_as_gamebits') . '";');
            $templater = vB_Template::create('v3a_CMS_as_gamebits');
        $templater->register('as_game_data',$as_game_data);
          $templater->register('game',$game);
          $as_gamebits .= $templater->render();

    }
    $vbulletin->db->free_result($getgames);

    // eval('$gametable = "' . fetch_template("v3a_CMS_as_{$as_handle}_gametable") . '";');
    $templater = vB_Template::create('v3a_CMS_as_' . $as_handle . '_gametable');
    $templater->register('as_title',$as_title);
    $templater->register('as_gamebits',$as_gamebits);
    $gametable = $templater->render();
    return $gametable;
}

function get_champs ($limit) {
    global $vbulletin;

    $champs = $vbulletin->db->query_read("
            SELECT COUNT(games.highscorerid) AS count, user.username, user.userid
        FROM " . TABLE_PREFIX . "v3arcade_games AS games
            LEFT JOIN " . TABLE_PREFIX . "user AS user ON user.userid = games.highscorerid
            WHERE user.userid IS NOT NULL
            GROUP BY user.username, user.userid
        ORDER BY count DESC, user.userid ASC
        LIMIT " . $limit
    );

    $row = '0';
    $awards = '0';
    $leaders = '0';
    while ($champ = $vbulletin->db->fetch_array($champs)) {
        $leaders++;
        if ($awards != $champ['count']) {
            $row = $leaders;
        }
        $awards = $champ['count'];
        $getbgrow = exec_switch_bg();
        //eval('$as_champbits .= "' . fetch_template('v3a_CMS_as_champbits') . '";');
        $templater = vB_Template::create('v3a_CMS_as_champbits');
        $templater->register('getbrow',$getbrow);
          $templater->register('champ',$champ);
          $as_champbits .= $templater->render();
    }
    $vbulletin->db->free_result($champs);

    //eval('$champstable = "' . fetch_template("v3a_CMS_as_champstable") . '";');
    $templater = vB_Template::create('v3a_CMS_as_champstable');
    $templater->register('as_champbits',$as_champbits);
    $champstable = $templater->render();
    return $champstable;
}

function get_random_game () {
    global $vbulletin;

    $random_game = $vbulletin->db->query_first("
        SELECT gameid,title,description,stdimage,highscore,user.userid,user.username
        FROM " . TABLE_PREFIX . "v3arcade_games AS games
            LEFT JOIN " . TABLE_PREFIX . "user AS user ON user.userid = games.highscorerid
        ORDER BY RAND()
        LIMIT 1
    ");

    $as_random_gameid = $random_game[gameid];
        $as_random_gametitle = $random_game[title];
        $as_random_stdimage = $random_game[stdimage];
        $as_random_description = $random_game[description];
    if($random_game[highscore] == 0)
    {
        $as_random_highscore    = "No Score";
        $as_random_highscorer    = "";
        $as_random_userid    = "";
    }
    else
    {
        $as_random_highscore    = intval($random_game[highscore]);
        $as_random_highscorer    = "(" . $random_game[username] . ")";
        $as_random_userid    = $random_game[userid];
    }
    $vbulletin->db->free_result($random_game);
    //eval('$random_table = "' . fetch_template('v3a_CMS_as_random') . '";');
    $templater = vB_Template::create('v3a_CMS_as_random');
    $templater->register('as_random_gameid',$as_random_gameid);
    $templater->register('as_random_gametitle',$as_random_gametitle);
    $templater->register('as_random_highscore',$as_random_highscore);
    $templater->register('as_random_userid',$as_random_userid);
    $templater->register('as_random_highscorer',$as_random_highscorer);
    $templater->register('as_random_stdimage',$as_random_stdimage);
    $templater->register('as_random_description',$as_random_description);
    $random_table = $templater->render();
    return $random_table;
}

function get_latest_champs ($limit)
{
    global $vbulletin, $bbcode_parser;

    //var_dump($vbulletin);
    //highlight_file('./modules/arcadestats.php');
    //exit;
    $news_items = $vbulletin->db->query_read("
        SELECT *
        FROM " . TABLE_PREFIX . "v3arcade_news
        WHERE newstext LIKE '%is the new%'
        ORDER BY datestamp DESC
        LIMIT $limit
    ");

    while ($news_item = $vbulletin->db->fetch_array($news_items)) {
          //$as_news_text =  $bbcode_parser->do_parse($news_item['newstext'], 1, 1, 1, 0);
        $as_news_text = $news_item['newstext'];
        $as_news_text = str_replace("arcade.php", $vbulletin->options['bburl'] . "/arcade.php", $as_news_text);

        $as_news_date = vbdate($vbulletin->options['dateformat'],$news_item['datestamp']);
        $as_news_time = vbdate($vbulletin->options['timeformat'],$news_item['datestamp']);
        $getbgrow = exec_switch_bg();
        //eval('$as_newsbits .= "' . fetch_template('v3a_CMS_as_newsbits') . '";');
        $templater = vB_Template::create('v3a_CMS_as_newsbits');
          $templater->register('getbrow',$getbrow);
          $templater->register('as_news_text',$as_news_text);
          $templater->register('as_news_date',$as_news_date);
          $templater->register('as_news_time',$as_news_time);
          $as_newsbits .= $templater->render();

    }
    $vbulletin->db->free_result($news_items);

    //eval('$news_table = "' . fetch_template('v3a_CMS_as_newstable') . '";');
    $templater = vB_Template::create('v3a_CMS_as_newstable');
    $templater->register('as_newsbits',$as_newsbits);
    $news_table = $templater->render();
    return $news_table;
}

function get_latest_scores ($limit)
{
    global $vbulletin;

    $latest_scores = $vbulletin->db->query_read("
        SELECT sessions.userid, sessions.gamename, sessions.gameid, sessions.score, sessions.start, sessions.finish,
            user.username,
            games.title
        FROM " . TABLE_PREFIX . "v3arcade_sessions as sessions
        LEFT JOIN " . TABLE_PREFIX . "user AS user
            ON (sessions.userid = user.userid)
        LEFT JOIN " . TABLE_PREFIX . "v3arcade_games as games
            on (sessions.gameid = games.gameid)
        WHERE valid = 1
            AND tourid = 0
          AND challengeid = 0
        ORDER BY  sessions.sessionid DESC
        LIMIT $limit
    ");

    while ($latest_score = $vbulletin->db->fetch_array($latest_scores)) {
        $as_score_userid = $latest_score['userid'];
        $as_score_gameid = $latest_score['gameid'];
        $as_score_name = $latest_score['username'];
        $as_score_score = floatval($latest_score['score']);
        $as_score_gametitle = $latest_score['title'];
        $as_score_date = vbdate($vbulletin->options['dateformat'],$latest_score['finish']);
        $as_score_time = vbdate($vbulletin->options['timeformat'],$latest_score['finish']);
        //echo "foo: $as_score_gametitle<br>\n";
        $getbgrow = exec_switch_bg();
        //eval('$as_scorebits .= "' . fetch_template('v3a_CMS_as_scorebits') . '";');
        $templater = vB_Template::create('v3a_CMS_as_scorebits');
          $templater->register('getbrow',$getbrow);
          $templater->register('as_score_userid',$as_score_userid);
          $templater->register('as_score_name',$as_score_name);
          $templater->register('as_score_score',$as_score_score);
          $templater->register('as_score_gameid',$as_score_gameid);
          $templater->register('as_score_gametitle',$as_score_gametitle);
          $templater->register('as_score_date',$as_score_date);
          $templater->register('as_score_time',$as_score_time);
          $as_scorebits .= $templater->render();
    }
    $vbulletin->db->free_result($latest_scores);

    //eval('$score_table = "' . fetch_template('v3a_CMS_as_scoretable') . '";');
    $templater = vB_Template::create('v3a_CMS_as_scoretable');
    $templater->register('as_scorebits',$as_scorebits);
    $score_table = $templater->render();
    return $score_table;
}

$as_score_table = get_latest_scores($g_scores_limit);
$as_news_table = get_latest_champs($g_news_limit);
$as_random_table = get_random_game();
$as_champs_table = get_champs($g_champs_limit);
$as_recent_table = get_games("recent","Most Recent", $g_limit);
$as_played_table = get_games("played","Most Played", $g_limit);
$as_popular_table = get_games("popular","Most Popular", $g_limit);

$collapseobj_arcadestats = $vbcollapse['collapseobj_arcadestats'];
$collapseimg_arcadestats = $vbcollapse['collapseimg_arcadestats'];

//eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('v3a_CMS_arcadestats1') . '";');
$templater = vB_Template::create('v3a_CMS_arcadestats1');
$templater->register('as_score_table',$as_score_table);
$templater->register('as_news_table',$as_news_table);
$templater->register('as_random_table',$as_random_table);
$templater->register('as_champs_table',$as_champs_table);
$templater->register('as_recent_table',$as_recent_table);
$templater->register('as_played_table',$as_played_table);
$templater->register('as_popular_table',$as_popular_table);
$output = $templater->render();

As with the CMS block you can comment parts out if you don't want them to display, for example if you only want the latest scores and latest champions you would comment the rest of the blocks out like so
Code:

$templater->register('as_score_table',$as_score_table);
$templater->register('as_news_table',$as_news_table);
//$templater->register('as_random_table',$as_random_table);
//$templater->register('as_champs_table',$as_champs_table);
//$templater->register('as_recent_table',$as_recent_table);
//$templater->register('as_played_table',$as_played_table);
//$templater->register('as_popular_table',$as_popular_table);


Gemma 09-26-2011 04:43 PM

If you would prefer a sideblock widget instead of a central one on the CMS, you can also replace the v3a_CMS_arcadestats with this code.

Code:

<div>
<table align="left" width="100%">
  <tr><td>{vb:raw as_score_table}</td></tr>
  <tr><td>{vb:raw as_news_table}</td></tr>
  <tr><td>{vb:raw as_random_table}</td></tr>
  <tr><td>{vb:raw as_champs_table}</td></tr>
  <tr><td>{vb:raw as_recent_table}</td></tr>
  <tr><td>{vb:raw as_played_table}</td></tr>
  <tr><td>{vb:raw as_popular_table}</td></tr>
</table>
</div>

And make a CMS siderbar widget (albeit a long one) instead of a central widget.

*Fixed the code so it displays properly in Google Chrome.

oldfan 09-28-2011 06:33 PM

Ive tried the sideblock version by Gemma and had no luck with it :(

Gemma 09-28-2011 06:39 PM

The forum sideblock or CMS sideblock.

Did you import the product?

Any error messages?

oldfan 09-28-2011 06:46 PM

Quote:

forum sideblock
Nope no messages, the block doesn't show up, could it have something to do with "Everywhere sidebar 1.4.4.4" mod?

Gemma 09-28-2011 06:53 PM

Not sure, I've never used that mod. Did you try purging the forumblock cache?

If you want to send me temp access I'll have a look for you.

tidus78 02-09-2012 10:13 AM

Hi Gemma!

I have this problem of layout in forum-block :

https://vborg.vbsupport.ru/

Gemma 02-09-2012 11:06 AM

Quote:

Originally Posted by tidus78 (Post 2297853)
Hi Gemma!

I have this problem of layout in forum-block :

http://img571.imageshack.us/img571/8...0209121029.png

Try re-importing the product file. I've changed 'View Leaderboard' to 'View Leaders' so it fits better.

tidus78 02-09-2012 11:31 AM

you are too operational :eek:

Thanks.....:D

doctorsexy 02-14-2012 02:35 PM

Installed again..thank you.....

ellinofatsa 03-18-2012 04:55 PM

i have vBadvanced CMPS is that work?or only for suite?

Gemma 03-18-2012 06:18 PM

CMS and/or forum sideblock.

I'm not sure if the CMPS version is still available, you'll need to check on vbadvanced.com

ellinofatsa 03-18-2012 07:17 PM

Quote:

Originally Posted by Gemma (Post 2310714)
CMS and/or forum sideblock.

I'm not sure if the CMPS version is still available, you'll need to check on vbadvanced.com

thank you gemma can you give my a link there?if you have

Gemma 03-18-2012 10:35 PM

Quote:

Originally Posted by ellinofatsa (Post 2310730)
thank you gemma can you give my a link there?if you have

No, I don't have a link. You'll need to ask them over on http://vbadvanced.com to see if the attachments have been fixed after the transfer from v3arcade.com

Here is the imported thread - http://www.vbadvanced.com/forum/showthread.php?t=47084

Gemma 05-17-2012 04:26 PM

A small bug was reported by one of my members where tournament scores were appearing in the latest scores block. To fix it in your widget/sideblock code -

Find:
Code:

WHERE sessions.finish <> 0
Replace with:
Code:

WHERE valid = 1
            AND tourid = 0

This code change will also prevent scores by guests from showing up in the latest scores block.

Gemma 06-11-2012 07:22 PM

Updated.

4.1.2 - removed challenge scores from appearing in latest score block.

To update, replace your existing widget code with the code in the OP. If you are using the sideblock code I've updated the code in this post - https://vborg.vbsupport.ru/showpost....9&postcount=11

Or simply, find
Code:

WHERE valid = 1
            AND tourid = 0

Replace with
Code:

WHERE valid = 1
            AND tourid = 0
            AND challengeid = 0


tele955848 09-21-2012 07:34 PM

Quote:

Create a new template called v3a_CMS_arcadestats1 and add the following code
looking at style and templates?
but find nothing
where I need to create the template for?
Template-Modifications manage

Gemma 09-21-2012 07:47 PM

Quote:

Originally Posted by tele955848 (Post 2367427)
looking at style and templates?
but find nothing
where I need to create the template for?
Template-Modifications manage

AdminCP > Styles & Templates > Style Manager

Choose the style you want to add a new template to (ex. Default Style) and from the dropdown box (to the right of the style name) select 'Add New Template'

Bob_R 09-21-2012 07:52 PM

Quote:

Originally Posted by Gemma (Post 2246049)
I've also been able to use almost all the same templates and php code to make a forum sideblock.

1. Install the product as normal.

2. Create a new template called v3a_CMS_arcadestats1 and add the following code
Code:

<div>
<table align="left" width="100%">
  <tr><td>{vb:raw as_score_table}</td></tr>
  <tr><td>{vb:raw as_news_table}</td></tr>
  <tr><td>{vb:raw as_random_table}</td></tr>
  <tr><td>{vb:raw as_champs_table}</td></tr>
  <tr><td>{vb:raw as_recent_table}</td></tr>
  <tr><td>{vb:raw as_played_table}</td></tr>
  <tr><td>{vb:raw as_popular_table}</td></tr>
</table>
</div>

3. Go to AdminCP > Forums & Moderators > Forum Block Manager > Add Block
Title - Arcade Stats (or whatever)
Content Type - PHP
Content -
Code:

global $vbulletin, $bbcode, $parser, $path, $db;
$g_limit = 5;
$g_champs_limit = 5;
$g_news_limit = 5;
$g_scores_limit = 5;

function get_games ($as_handle, $as_title, $limit) {
    global $vbulletin;

    switch ($as_handle) {
        case 'recent':
            $orderby = "dateadded DESC";
            break;
        case 'played':
            $orderby = "sessioncount DESC";
            break;
        case 'popular':
            $orderby = "votepoints DESC";
            break;
        default:
            $orderby = "gameid ASC";
            break;
    }


    $getgames = $vbulletin->db->query("
            SELECT games.* FROM " . TABLE_PREFIX . "v3arcade_games AS games
            ORDER BY " . $orderby . "
            LIMIT $limit
    ");

    while ($game = $vbulletin->db->fetch_array($getgames))
    {
            $game['gamename'] = fetch_trimmed_title(stripslashes($game['title']),$maxtitlechars);
            $game['gamedate'] = vbdate($vbulletin->options['dateformat'], $game['dateadded']);
            $getbgrow = exec_switch_bg();

        switch ($as_handle) {
            case 'recent':
                $as_game_data = $game['gamedate'];
                break;
            case 'played':
                $as_game_data = "Played " . $game['sessioncount'] . " times";
                break;
            case 'popular':
                $as_game_data = $game['votepoints'] . " votes";
                break;
            default:
                $as_game_data = "";
                break;
        }

            //eval('$as_gamebits .= "' . fetch_template('v3a_CMS_as_gamebits') . '";');
            $templater = vB_Template::create('v3a_CMS_as_gamebits');
        $templater->register('as_game_data',$as_game_data);
          $templater->register('game',$game);
          $as_gamebits .= $templater->render();

    }
    $vbulletin->db->free_result($getgames);

    // eval('$gametable = "' . fetch_template("v3a_CMS_as_{$as_handle}_gametable") . '";');
    $templater = vB_Template::create('v3a_CMS_as_' . $as_handle . '_gametable');
    $templater->register('as_title',$as_title);
    $templater->register('as_gamebits',$as_gamebits);
    $gametable = $templater->render();
    return $gametable;
}

function get_champs ($limit) {
    global $vbulletin;

    $champs = $vbulletin->db->query_read("
            SELECT COUNT(games.highscorerid) AS count, user.username, user.userid
        FROM " . TABLE_PREFIX . "v3arcade_games AS games
            LEFT JOIN " . TABLE_PREFIX . "user AS user ON user.userid = games.highscorerid
            WHERE user.userid IS NOT NULL
            GROUP BY user.username, user.userid
        ORDER BY count DESC, user.userid ASC
        LIMIT " . $limit
    );

    $row = '0';
    $awards = '0';
    $leaders = '0';
    while ($champ = $vbulletin->db->fetch_array($champs)) {
        $leaders++;
        if ($awards != $champ['count']) {
            $row = $leaders;
        }
        $awards = $champ['count'];
        $getbgrow = exec_switch_bg();
        //eval('$as_champbits .= "' . fetch_template('v3a_CMS_as_champbits') . '";');
        $templater = vB_Template::create('v3a_CMS_as_champbits');
        $templater->register('getbrow',$getbrow);
          $templater->register('champ',$champ);
          $as_champbits .= $templater->render();
    }
    $vbulletin->db->free_result($champs);

    //eval('$champstable = "' . fetch_template("v3a_CMS_as_champstable") . '";');
    $templater = vB_Template::create('v3a_CMS_as_champstable');
    $templater->register('as_champbits',$as_champbits);
    $champstable = $templater->render();
    return $champstable;
}

function get_random_game () {
    global $vbulletin;

    $random_game = $vbulletin->db->query_first("
        SELECT gameid,title,description,stdimage,highscore,user.userid,user.username
        FROM " . TABLE_PREFIX . "v3arcade_games AS games
            LEFT JOIN " . TABLE_PREFIX . "user AS user ON user.userid = games.highscorerid
        ORDER BY RAND()
        LIMIT 1
    ");

    $as_random_gameid = $random_game[gameid];
        $as_random_gametitle = $random_game[title];
        $as_random_stdimage = $random_game[stdimage];
        $as_random_description = $random_game[description];
    if($random_game[highscore] == 0)
    {
        $as_random_highscore    = "No Score";
        $as_random_highscorer    = "";
        $as_random_userid    = "";
    }
    else
    {
        $as_random_highscore    = intval($random_game[highscore]);
        $as_random_highscorer    = "(" . $random_game[username] . ")";
        $as_random_userid    = $random_game[userid];
    }
    $vbulletin->db->free_result($random_game);
    //eval('$random_table = "' . fetch_template('v3a_CMS_as_random') . '";');
    $templater = vB_Template::create('v3a_CMS_as_random');
    $templater->register('as_random_gameid',$as_random_gameid);
    $templater->register('as_random_gametitle',$as_random_gametitle);
    $templater->register('as_random_highscore',$as_random_highscore);
    $templater->register('as_random_userid',$as_random_userid);
    $templater->register('as_random_highscorer',$as_random_highscorer);
    $templater->register('as_random_stdimage',$as_random_stdimage);
    $templater->register('as_random_description',$as_random_description);
    $random_table = $templater->render();
    return $random_table;
}

function get_latest_champs ($limit)
{
    global $vbulletin, $bbcode_parser;

    //var_dump($vbulletin);
    //highlight_file('./modules/arcadestats.php');
    //exit;
    $news_items = $vbulletin->db->query_read("
        SELECT *
        FROM " . TABLE_PREFIX . "v3arcade_news
        WHERE newstext LIKE '%is the new%'
        ORDER BY datestamp DESC
        LIMIT $limit
    ");

    while ($news_item = $vbulletin->db->fetch_array($news_items)) {
          //$as_news_text =  $bbcode_parser->do_parse($news_item['newstext'], 1, 1, 1, 0);
        $as_news_text = $news_item['newstext'];
        $as_news_text = str_replace("arcade.php", $vbulletin->options['bburl'] . "/arcade.php", $as_news_text);

        $as_news_date = vbdate($vbulletin->options['dateformat'],$news_item['datestamp']);
        $as_news_time = vbdate($vbulletin->options['timeformat'],$news_item['datestamp']);
        $getbgrow = exec_switch_bg();
        //eval('$as_newsbits .= "' . fetch_template('v3a_CMS_as_newsbits') . '";');
        $templater = vB_Template::create('v3a_CMS_as_newsbits');
          $templater->register('getbrow',$getbrow);
          $templater->register('as_news_text',$as_news_text);
          $templater->register('as_news_date',$as_news_date);
          $templater->register('as_news_time',$as_news_time);
          $as_newsbits .= $templater->render();

    }
    $vbulletin->db->free_result($news_items);

    //eval('$news_table = "' . fetch_template('v3a_CMS_as_newstable') . '";');
    $templater = vB_Template::create('v3a_CMS_as_newstable');
    $templater->register('as_newsbits',$as_newsbits);
    $news_table = $templater->render();
    return $news_table;
}

function get_latest_scores ($limit)
{
    global $vbulletin;

    $latest_scores = $vbulletin->db->query_read("
        SELECT sessions.userid, sessions.gamename, sessions.gameid, sessions.score, sessions.start, sessions.finish,
            user.username,
            games.title
        FROM " . TABLE_PREFIX . "v3arcade_sessions as sessions
        LEFT JOIN " . TABLE_PREFIX . "user AS user
            ON (sessions.userid = user.userid)
        LEFT JOIN " . TABLE_PREFIX . "v3arcade_games as games
            on (sessions.gameid = games.gameid)
        WHERE valid = 1
            AND tourid = 0
          AND challengeid = 0
        ORDER BY  sessions.sessionid DESC
        LIMIT $limit
    ");

    while ($latest_score = $vbulletin->db->fetch_array($latest_scores)) {
        $as_score_userid = $latest_score['userid'];
        $as_score_gameid = $latest_score['gameid'];
        $as_score_name = $latest_score['username'];
        $as_score_score = floatval($latest_score['score']);
        $as_score_gametitle = $latest_score['title'];
        $as_score_date = vbdate($vbulletin->options['dateformat'],$latest_score['finish']);
        $as_score_time = vbdate($vbulletin->options['timeformat'],$latest_score['finish']);
        //echo "foo: $as_score_gametitle<br>\n";
        $getbgrow = exec_switch_bg();
        //eval('$as_scorebits .= "' . fetch_template('v3a_CMS_as_scorebits') . '";');
        $templater = vB_Template::create('v3a_CMS_as_scorebits');
          $templater->register('getbrow',$getbrow);
          $templater->register('as_score_userid',$as_score_userid);
          $templater->register('as_score_name',$as_score_name);
          $templater->register('as_score_score',$as_score_score);
          $templater->register('as_score_gameid',$as_score_gameid);
          $templater->register('as_score_gametitle',$as_score_gametitle);
          $templater->register('as_score_date',$as_score_date);
          $templater->register('as_score_time',$as_score_time);
          $as_scorebits .= $templater->render();
    }
    $vbulletin->db->free_result($latest_scores);

    //eval('$score_table = "' . fetch_template('v3a_CMS_as_scoretable') . '";');
    $templater = vB_Template::create('v3a_CMS_as_scoretable');
    $templater->register('as_scorebits',$as_scorebits);
    $score_table = $templater->render();
    return $score_table;
}

$as_score_table = get_latest_scores($g_scores_limit);
$as_news_table = get_latest_champs($g_news_limit);
$as_random_table = get_random_game();
$as_champs_table = get_champs($g_champs_limit);
$as_recent_table = get_games("recent","Most Recent", $g_limit);
$as_played_table = get_games("played","Most Played", $g_limit);
$as_popular_table = get_games("popular","Most Popular", $g_limit);

$collapseobj_arcadestats = $vbcollapse['collapseobj_arcadestats'];
$collapseimg_arcadestats = $vbcollapse['collapseimg_arcadestats'];

//eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('v3a_CMS_arcadestats1') . '";');
$templater = vB_Template::create('v3a_CMS_arcadestats1');
$templater->register('as_score_table',$as_score_table);
$templater->register('as_news_table',$as_news_table);
$templater->register('as_random_table',$as_random_table);
$templater->register('as_champs_table',$as_champs_table);
$templater->register('as_recent_table',$as_recent_table);
$templater->register('as_played_table',$as_played_table);
$templater->register('as_popular_table',$as_popular_table);
$output = $templater->render();

As with the CMS block you can comment parts out if you don't want them to display, for example if you only want the latest scores and latest champions you would comment the rest of the blocks out like so
Code:

$templater->register('as_score_table',$as_score_table);
$templater->register('as_news_table',$as_news_table);
//$templater->register('as_random_table',$as_random_table);
//$templater->register('as_champs_table',$as_champs_table);
//$templater->register('as_recent_table',$as_recent_table);
//$templater->register('as_played_table',$as_played_table);
//$templater->register('as_popular_table',$as_popular_table);


Can this be accomplished on the Arcade page itself?

And, if so how?

Thanks!!

Gemma 09-24-2012 04:39 PM

You probably could but most of the data is already available in the arcade though and I've got another mod on here that displays the Most Played/Top Rated games in tabs so my thinking is that it would be more hassle than it is worth.

You'd need to add the missing database queries into the arcade.php file, edit out the current arcade sideblock (in the v3ARCADE_MAIN template) and then amend the templates from this mod to work in the arcade and add then to the v3ARCADE_MAIN template.

Not something I'd be looking at doing

Gemma 12-17-2012 04:57 PM

Made a small update.

4.1.3 - Linked usernames in Latest Scores and Top Champs to Member Profile Arcade Tab

To update, re-import the product file.

oldfan 01-04-2013 09:16 PM

Quote:

Originally Posted by oldfan (Post 2251019)
Nope no messages, the block doesn't show up, could it have something to do with "Everywhere sidebar 1.4.4.4" mod?

I've tried adding it again and had no luck - http://www.metallifukinca.com/forums.php
Its the last block

Gemma 01-04-2013 10:44 PM

Quote:

Originally Posted by oldfan (Post 2394764)
I've tried adding it again and had no luck - http://www.metallifukinca.com/forums.php
Its the last block

If I have time tomorrow I'll install Everywhere Sidebar and see where the problem lies. Never used it before so can't tell you offhand.

oldfan 01-05-2013 01:13 AM

Quote:

Originally Posted by Gemma (Post 2394787)
If I have time tomorrow I'll install Everywhere Sidebar and see where the problem lies. Never used it before so can't tell you offhand.

thanks a lot :)

oldfan 01-15-2013 12:35 PM

Any luck Gemma?

Gemma 01-17-2013 10:43 PM

Sorry, I'm having a few health problems again just now so I've not been online and I'm probably going to be deleting my site so won't have a chance to look into this. If anyone else knows or can help then I'd appreciate them looking into why it doesn't work.

londoner 11-19-2013 01:59 AM

Thanks a bunch for this mod, i dont use the cms but i wanted to use it for the sideblock addon.

I dont have the "Everywhere sidebar" mod and it still does'nt work for me.
I had the CMS disabled as I don't use it and I thought it was that so I enabled it, purged the cache for the sidebar, re-installed the product and I still have the problem and am having no luck in trying to fix it, it is not showing in the sidebar at all, and I am not getting any errors in my log. It is however showing on the CMS (Which I do not use and only enabled it to see if this mod would work). If someone can please test this to see if others have this problem, and plz if anyone finds a solution I would really appreciate it.

thx

Gemma 11-19-2013 09:50 PM

I don't use vBulletin anymore and I'm not involved with any sites running v3 Arcade but if you want to PM me temporary admin login details for your site I'll check out any problem for you.

Just to check, did you follow the instructions in this post for the forum sidebar?

https://vborg.vbsupport.ru/showpost....9&postcount=11

ckgb 01-25-2014 10:51 AM

If anybody has vBAdvanced module to share, I'd greatly appreciate it.


All times are GMT. The time now is 05:25 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01566 seconds
  • Memory Usage 2,017KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (15)bbcode_code_printable
  • (11)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (39)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete