Version: 1.00, by Gemma
Developer Last Online: Nov 2023
Category: Add-On Releases -
Version: 4.x.x
Rating:
Released: 04-28-2011
Last Update: Never
Installs: 26
Template Edits
Re-useable Code Code Changes
No support by the author.
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();
}
I added this, and you're right, this is exactly where it should be!
I'm having one issue with this in that the phrase never changes from "Add to Favorites" This is whether I click the icons or the words. The icons switch back and forth as they should, and so does the alt text. But the phrase stays the same.
I just upgraded to 4.2.0 so I don't know if this is just a coincidence or not, but worth mentioning.
---just noticed that the words actually staying the same no matter what the phrase is, depending on where it starts after a page load. When page refreshes, the icon, words, and alt text all match and correct. However, from then on, clicking doesn't change the words.
It works as it was designed to work. That's how it is throughout the arcade, the link doesn't change dynamically, it will only change between the two phrases once you revisit the page or another page where favourites can be added or removed.
I guess when the arcade was designed they weren't expecting someone being indecisive about whether a game was a favourite or not and rapidly clicking between adding and removing a game.
Thanks for the explanation. I don't think people are indecisive as to whether they want a game to be a favorite. Having a link that says one thing yet means the opposite can be confusing to the users. Creating a workaround is easy enough, which is to simply create a button image that says add or remove favorite, then get rid of the text. I just thought it was a mistake that you weren't aware of and would want to correct. Your "it's a feature not a bug" explanation is good enough for me.
Please understand that I wasn't criticizing you free contribution, your coding skills, or the v3arcade design overall. Just bringing information to the discussion.
(That and the fact that after fooling around with the if statements for almost an hour today with no luck, I was very curious as to how it was possible to make it work that way just from a sheer intellectual level. I was feeling defeated by a few lines of code.)
On the off chance that someone else wants this change, I've attached a couple of replacement images I whipped up for my install. Just remove the portion of code below from Gemma's, then upload the two gifs.