PDA

View Full Version : WOL locations for sub-pages


veenuisthebest
11-22-2008, 03:57 PM
I know how to create custom WOL locations but How do we create custom online locations for sub-pages like I want the exact location to display when user is viewing page.php?do=this&uid=12

For example, this is the WOL code of ibproarcade:-

Hook: online_location_unknown

if ($userinfo['activity'] == 'arcade')
{
$gameid =& $userinfo['gameid'];
global $wol_games;
$gametitle =& $wol_games["$gameid"];
switch($userinfo['values']['do'])
{
case 'play':
$userinfo['action'] = $vbphrase['ibproarcade_playing_game'];
$userinfo['where'] = '<a href="arcade.php?' . $vbulletin->session->vars['sessionurl'] . "do=play&amp;gameid=$gameid\">$gametitle</a>";
break;
case 'stats':
$userinfo['action'] = $vbphrase['ibproarcade_viewing_highscores'];
$userinfo['where'] = '<a href="arcade.php?' . $vbulletin->session->vars['sessionurl'] . "do=stats&amp;gameid=$gameid\">$gametitle</a>";
break;
default:
$userinfo['action'] = $vbphrase['ibproarcade_viewing_home'];
$userinfo['where'] = '<a href="arcade.php' . $vbulletin->session->vars['sessionurl_q'] . "\">$vbphrase[ibproarcade_home]</a>";
break;
}
$handled = true;
DEVDEBUG("gameid = " . $userinfo['gameid']);
}


Hook: online_location_process

if (($filename == 'arcade.php') || ($filename == 'holdsession.php'))
{
$userinfo['activity'] = 'arcade';
if (!empty($values['gameid']))
{
$userinfo['gameid'] = intval($values['gameid']);
global $gameids;
$gameids .= ',' . $userinfo['gameid'];
}
}


Can anybody explain me how its done? Thanks

SEOvB
11-22-2008, 07:13 PM
I'm not sure you'll be able to unless you can define the subpage with a unique script name.

veenuisthebest
11-22-2008, 07:26 PM
That is why I posted the arcade's WOL code as an example and I have seen few other mods as well. It can surely be done with switch case, just need to understand how to start. How are those vars defined like that?

--------------- Added 1227409484 at 1227409484 ---------------

alright so switch case is working good for me, just the variable thing for $userinfo['where'] is required. Can anybody tell me how to make my variables available there so I can write my URL's.

Thanks

veenuisthebest
11-24-2008, 08:50 AM
anybody... is shouldn't be tough !

Lynne
11-24-2008, 02:46 PM
Did you try to write it yourself based on the arcade code example? Perhaps if you post your code for the two plugins then people can help you.

veenuisthebest
11-24-2008, 03:12 PM
OFCOURSE, i always try things 20 times before asking here.

My code is as simple as in any article of WOL here, ALSO, arcade's code helped me to define locations for sub-pages BUT how to make the URL variables available for $userinfo['where'].

My code:-

Hook: online_location_process

if ($filename == 'myfile.php')
{
$userinfo['activity'] = 'myprocess';
}


Hook: online_location_unknown

if ($userinfo['activity'] == 'myprocess')
{
switch($userinfo['values']['do'])
{
case 'view':
$userinfo['action'] = 'Viewing Item';
$userinfo['where'] = 'I NEED HELP WITH THIS'
break;
default:
$userinfo['action'] = 'Vewing Custom Page';
break;
}
$handled = true;
}


The switch case is working good. BUT how to build the URL in userinfo[where]. How to make the variables available there just like arcade's code gameid and gametitle variables

Thanks

veenuisthebest
11-26-2008, 02:14 AM
There was already a wonderful article here that helped me achieve this in few minutes
https://vborg.vbsupport.ru/showthread.php?t=113725

Thanks to siradrian