Back to vBulletin 4.x Add-ons

v3 Arcade Add To Favourites In Game Play Area
Mod Version: 1.00, by Gemma

vB Version: 4.x.x Rating: (5 votes - 5.00 average) Installs: 26
Released: 29 Apr 2011 Last Update: Never Downloads: 38
Not Supported Template Edits Code Changes Re-usable Code  

I've noticed that there is no way of adding a game to your favourites whilst playing the game, at present you can only add via the category list or when submitting a score. Personally I think adding when playing makes more sense.

To do this, open your arcade.php file and find:

Code:
// ############################################################################
// Play a game
// ############################################################################
if ($_REQUEST['do'] == 'play')
{
    $vbulletin->input->clean_array_gpc('r', array(
        'challengeid' => TYPE_UINT,
        'gameid' => TYPE_UINT,
        'resolution' => TYPE_INT,
        'tid' => TYPE_UINT
    ));
Below that add:

Code:
$favcache = unserialize($vbulletin->userinfo['favcache']);
    $show['fav'] = ($favcache[$vbulletin->GPC['gameid']]);
// set favorites
    $favcache = unserialize($vbulletin->userinfo['favcache']);
    if (!is_array($favcache))
    {
        $favcache = array();
    }
Save the file and re-upload

In your v3ARCADE_PLAY template search for:

Code:
<div class="blockrow" align="center">
                        <vb:if condition="!$show['challenge'] AND !$show['tournament']">
                            <img src="{vb:raw vboptions.arcadeimages}/backtip.gif" border="0" alt="" />
                        <vb:else />
                            {vb:rawphrase challenge_warning}
                        </vb:if>
                    </div>
Below that add:

Code:
<!-- favorites -->
                <div class="blockrow" align="center">
                            <vb:if condition="$show['fav']">
                                <img src="{vb:raw vboptions.arcadeimages}/subfav.gif" id="fav_{vb:raw game.gameid}" class="point" onclick="dofav({vb:raw game.gameid})" alt="{vb:rawphrase sub_favorite}" border="0" />
                            <vb:else />
                                <img src="{vb:raw vboptions.arcadeimages}/addfav.gif" id="fav_{vb:raw game.gameid}" class="point" onclick="dofav({vb:raw game.gameid})" alt="{vb:rawphrase add_favorite}" border="0" />
                            </vb:if>
                            <span id="favlabel" onclick="dofav({vb:raw game.gameid})" style="cursor:pointer; text-decoration: underline">
                                <vb:if condition="$show['fav']">{vb:rawphrase sub_favorite}<vb:else />{vb:rawphrase add_favorite}</vb:if>
                            </span>
                        </div>
                                <!-- end of favorites -->
If anyone wants to further develop any of my addons, you are free to do so.

Download

File Type: %1$s Add Favourites To Game Play Area.txt (2.5 KB, 42 downloads)

Screenshots

Click image for larger version
Name:	favs.jpg
Views:	278
Size:	84.0 KB
ID:	128646  


vblts.ru supports vBulletin®, 2022-2024