vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   v3arcade Favorites Mod (https://vborg.vbsupport.ru/showthread.php?t=101862)

amykhar 11-30-2005 01:23 AM

I didn't do that because I didn't want to bulk up the query, Michelle. But, I may do it in the future.

Vizionz 11-30-2005 01:25 AM

Quote:

Originally Posted by amykhar
You guys do realize that John's probably never going to read this thread and it might be better to discuss your arcade wish list somewhere John'll read it, right?

i know that :) but i like you to see ideas too since your a great coder amy :) and maybe you would find use in something and decide to do it for yourself then shair the code like usual :P

Lea Verou 11-30-2005 01:27 AM

Quote:

Originally Posted by amykhar
I didn't do that because I didn't want to bulk up the query, Michelle. But, I may do it in the future.

I suspected that :) You could add it as an option though so that smaller forums can take advantage of it :)

Oblivion Knight 11-30-2005 06:28 AM

Quote:

Originally Posted by amykhar
I didn't do that because I didn't want to bulk up the query, Michelle. But, I may do it in the future.

I remember trying to handle that with a cache in the 3.0.x version, but it was an absolute nightmare.. :speechless:

Gizmo5h1t3 11-30-2005 06:11 PM

might be wise to add that this wont work with the alternative layout hack released on here......

amykhar 11-30-2005 11:22 PM

I guess you just added that :D I haven't seen the alternative layout mod.

wcbryant 12-01-2005 06:54 AM

Does anyone have this working in v3a 1.0.2 with OK's "Who's Online" and the "Leader Board" hacks? I know that's a stretch, but thought I'd try. I seem to get a blank white page, and wonder if it's a conflict with any of the above.

amykhar 12-01-2005 12:55 PM

A bit of experimentation on my site shows that performance isn't taking a big hit when I do this. So... I have updated the code to dynamically show if a game is a favorite or not on the category lists.

If you have already installed the mod, here is how to upgrade:

1. Find:
Code:

        else if ($vbulletin->GPC['categoryid']==2)
        {
                // Favorites
    $gamecountquery = ("SELECT * FROM " . TABLE_PREFIX."eaarcade_favorites
    WHERE userid=" . $vbulletin->userinfo['userid'] . "
    GROUP BY userid ASC");
                $gamecount = $db->num_rows($gamecountquery);

                $perpage =  $vbulletin->input->clean_gpc('r', 'perpage', TYPE_UINT);

                // set defaults
                sanitize_pageresults($gamecount, $pagenumber, $perpage, 100, $vbulletin->options['gamesperpage']);

                $start = (int)($perpage*$pagenumber)-$perpage;

                $pagenav = construct_page_nav($pagenumber, $perpage, $gamecount, 'arcade.php?' . $vbulletin->session->vars['sessionurl'], ""
                . (!empty($vbulletin->GPC['categoryid']) ? "&categoryid=" . $vbulletin->GPC['categoryid'] : "")
                . (!empty($vbulletin->GPC['perpage']) ? "&pp=$perpage" : "")
                );

                        $games = $db->query_read("SELECT eaarcade_favorites.gameid, arcade_games.*, user.username, arcade_categories.catname FROM " . TABLE_PREFIX . "eaarcade_favorites AS eaarcade_favorites
                  LEFT JOIN " . TABLE_PREFIX . "arcade_games AS arcade_games ON (arcade_games.gameid=eaarcade_favorites.gameid)
                  LEFT JOIN " . TABLE_PREFIX . "user AS user ON (arcade_games.highscorerid=user.userid)
                  LEFT JOIN " . TABLE_PREFIX . "arcade_categories AS arcade_categories ON (arcade_games.categoryid=arcade_categories.categoryid)
                  WHERE eaarcade_favorites.userid=" . $vbulletin->userinfo['userid'] . " AND arcade_games.title IS NOT NULL
                " . iif($bitfieldcheck, "AND $bitfieldcheck") . "
                  ORDER BY eaarcade_favorites.gameid DESC
                  LIMIT $start,".$vbulletin->options['gamesperpage']);
        } else        {

Replace with:
-----------
Code:

        else if ($vbulletin->GPC['categoryid']==2)
        {
                // Favorites
    $gamecountquery = ("SELECT * FROM " . TABLE_PREFIX."eaarcade_favorites
    WHERE userid=" . $vbulletin->userinfo['userid'] . "
    GROUP BY userid ASC");
                $gamecount = $db->num_rows($gamecountquery);

                $perpage =  $vbulletin->input->clean_gpc('r', 'perpage', TYPE_UINT);

                // set defaults
                sanitize_pageresults($gamecount, $pagenumber, $perpage, 100, $vbulletin->options['gamesperpage']);

                $start = (int)($perpage*$pagenumber)-$perpage;

                $pagenav = construct_page_nav($pagenumber, $perpage, $gamecount, 'arcade.php?' . $vbulletin->session->vars['sessionurl'], ""
                . (!empty($vbulletin->GPC['categoryid']) ? "&categoryid=" . $vbulletin->GPC['categoryid'] : "")
                . (!empty($vbulletin->GPC['perpage']) ? "&pp=$perpage" : "")
                );

                        $games = $db->query_read("SELECT eaarcade_favorites.*, arcade_games.*, user.username, arcade_categories.catname FROM " . TABLE_PREFIX . "eaarcade_favorites AS eaarcade_favorites
                  LEFT JOIN " . TABLE_PREFIX . "arcade_games AS arcade_games ON (arcade_games.gameid=eaarcade_favorites.gameid)
                  LEFT JOIN " . TABLE_PREFIX . "user AS user ON (arcade_games.highscorerid=user.userid)
                  LEFT JOIN " . TABLE_PREFIX . "arcade_categories AS arcade_categories ON (arcade_games.categoryid=arcade_categories.categoryid)
                  WHERE eaarcade_favorites.userid=" . $vbulletin->userinfo['userid'] . " AND arcade_games.title IS NOT NULL
                " . iif($bitfieldcheck, "AND $bitfieldcheck") . "
                  ORDER BY eaarcade_favorites.gameid DESC
                  LIMIT $start,".$vbulletin->options['gamesperpage']);
        } else        {

-----------

Find:
Code:

        $games = $db->query_read("SELECT arcade_games.*, user.username, arcade_categories.catname FROM " . TABLE_PREFIX . "arcade_games AS arcade_games
                LEFT JOIN " . TABLE_PREFIX . "user AS user ON (arcade_games.highscorerid=user.userid)
                LEFT JOIN " . TABLE_PREFIX . "arcade_categories AS arcade_categories ON (arcade_games.categoryid=arcade_categories.categoryid)
                " . iif($vbulletin->GPC['categoryid']!=-1, "WHERE arcade_games.categoryid=" . $vbulletin->GPC['categoryid'] . iif($bitfieldcheck, " AND $bitfieldcheck"), iif($bitfieldcheck, "WHERE $bitfieldcheck")) . "
                ORDER BY title ASC
                LIMIT $start, " . $vbulletin->options['gamesperpage']);

Replace with:
Code:

                $games = $db->query_read("SELECT arcade_games.*, favorites.favid AS favid, user.username, arcade_categories.catname FROM " . TABLE_PREFIX . "arcade_games AS arcade_games
                LEFT JOIN " . TABLE_PREFIX . "user AS user ON (arcade_games.highscorerid=user.userid)
                LEFT JOIN " . TABLE_PREFIX . "eaarcade_favorites AS favorites ON (favorites.gameid=arcade_games.gameid)
                LEFT JOIN " . TABLE_PREFIX . "arcade_categories AS arcade_categories ON (arcade_games.categoryid=arcade_categories.categoryid)
                " . iif($vbulletin->GPC['categoryid']!=-1, "WHERE favorites.userid=". $vbulletin->userinfo[userid]." AND arcade_games.categoryid=" . $vbulletin->GPC['categoryid'] . iif($bitfieldcheck, " AND $bitfieldcheck"), iif($bitfieldcheck, "WHERE $bitfieldcheck")) . "
                ORDER BY title ASC
                LIMIT $start, " . $vbulletin->options['gamesperpage']);

In your arcade_game_bit template, Replace the code block you added previously with:
Code:

<br /> <if condition="$game[favid]"><a href="arcade.php?do=delfav&gameid=$game[gameid]">$vbphrase[arcadedelfav]</a><else /><a href="arcade.php?do=addfav&gameid=$game[gameid]">$vbphrase[arcadeaddfav]</a></if>
(Note: only the conditional changed in the template.)

Maagic 12-01-2005 02:28 PM

I'm getting

Parse error: parse error, unexpected T_ELSE in /home/(deleted)/public_html/forum/arcade.php on line 442

Oblivion Knight 12-01-2005 05:35 PM

Quote:

Originally Posted by wcbryant
Does anyone have this working in v3a 1.0.2 with OK's "Who's Online" and the "Leader Board" hacks? I know that's a stretch, but thought I'd try. I seem to get a blank white page, and wonder if it's a conflict with any of the above.

Nope, this works fine with the Who's Online and Leader Board addons.. ;)


Quote:

Originally Posted by Gizmo5h1t3
might be wise to add that this wont work with the alternative layout hack released on here......

Once I've updated the Alternative Layout mod, I'll provide some instructions for adding this mod to it..


All times are GMT. The time now is 04:34 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.01141 seconds
  • Memory Usage 1,762KB
  • 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
  • (5)bbcode_code_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete