Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-21-2012, 04:59 PM
KGodel's Avatar
KGodel KGodel is offline
 
Join Date: May 2011
Location: Indiana
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Custom "User Location" for Who's Online

Hey all! I am trying to add locations for custom pages (mods) I am using that have different pages using one file, i.e. pages.php?pageid=1 is different than pages.php?pageid=6. Currently, I have the following code:

First Plugin Hook Location: online_location_process
PHP Code:
if ($filename == 'pages.php') {
    switch (
$_GET['pageid']) {
        case 
1:
        case 
2:
        case 
3:
        case 
4:
        case 
5:
        case 
6:
        case 
7:
        case 
8:
        case 
9:
        case 
10:
        case 
11:
        case 
12:
        case 
13:
        case 
14:
        case 
16:
        case 
17:
            
$userinfo['activity'] = 'ltc';
            break;
        case 
15:
        case 
20:
            
$userinfo['activity'] = 'rosters';
            break;
        case 
18:
            
$userinfo['activity'] = 'finances';
            break;
        default:
            
$userinfo['activity'] = 'pages';
            break;
    }
}
elseif (
$filename == 'forms.php') {
    switch (
$_GET['fid']) {
        case 
1:
            
$userinfo['activity'] = 'form_complaint';
            break;
        case 
2:
            
$userinfo['activity'] = 'newapp';
            break;
        case 
3:
            
$userinfo['activity'] = 'appeal';
            break;
        case 
4:
            
$userinfo['activity'] = 'goapp';
            break;
        case 
5:
            
$userinfo['activity'] = 'poapp';
            break;
        case 
6:
            
$userinfo['activity'] = 'dlapp';
            break;
        case 
7:
            
$userinfo['activity'] = 'offteam';
            break;
        case 
8:
            
$userinfo['activity'] = 'eaapp';
            break;
        case 
9:
            
$userinfo['activity'] = 'adminreq';
            break;
        case 
10:
            
$userinfo['activity'] = 'joapp';
            break;
        case 
12:
            
$userinfo['activity'] = 'awardnom';
            break;
        case 
14:
            
$userinfo['activity'] = 'moapp';
            break;
        case 
15:
            
$userinfo['activity'] = 'webreq';
            break;
        case 
16:
            
$userinfo['activity'] = 'gaapp';
            break;
        case 
17:
            
$userinfo['activity'] = 'unoffteam';
            break;
        case 
18:
            
$userinfo['activity'] = 'expreq';
            break;
        default:
            
$userinfo['activity'] = 'forms';
            break;
    }

Second Plugin Hook Location: online_location_unknown
PHP Code:
switch ($userinfo['activity']) {
    case 
'ltc':
        
$userinfo['action'] = 'Viewing the Leadership Training Center';
        
$handled true;
        break;
    case 
'rosters':
        
$userinfo['action'] = 'Viewing Clan Rosters';
        
$handled true;
        break;
    case 
'finances':
        
$userinfo['action'] = 'Viewing Clan Finances';
        
$handled true;
        break;
    case 
'form_complaint':
        
$userinfo['action'] = 'Submitting a User Comaplint';
        
$handled true;
        break;
    case 
'newapp':
        
$userinfo['action'] = 'Applying to the Clan';
        
$handled true;
        break;
    case 
'appeal':
        
$userinfo['action'] = 'Submitting an Appeal';
        
$handled true;
        break;
    case 
'goapp':
        
$userinfo['action'] = 'Applying for GO';
        
$handled true;
        break;
    case 
'poapp':
        
$userinfo['action'] = 'Applying for PO';
        
$userinfo['where'] = '';
        
$handled true;
        break;
    case 
'dlapp':
        
$userinfo['action'] = 'Applying for DL';
        
$handled true;
        break;
    case 
'offteam':
        
$userinfo['action'] = 'Applying for an Official Team';
        
$handled true;
        break;
    case 
'eaapp':
        
$userinfo['action'] = 'Applying for EA';
        
$handled true;
        break;
    case 
'adminreq':
        
$userinfo['action'] = 'Submitting an Admin Request';
        
$handled true;
        break;
    case 
'joapp':
        
$userinfo['action'] = 'Applying for JO';
        
$handled true;
        break;
    case 
'awardnom':
        
$userinfo['action'] = 'Nominating a Member for an Award';
        
$handled true;
        break;
    case 
'moapp':
        
$userinfo['action'] = 'Applying for MO';
        
$handled true;
        break;
    case 
'webreq':
        
$userinfo['action'] = 'Submitting Web Content';
        
$handled true;
        break;
    case 
'gaapp':
        
$userinfo['action'] = 'Applying for GA';
        
$handled true;
        break;
    case 
'unoffteam':
        
$userinfo['action'] = 'Applying for an Unofficial Team';
        
$handled true;
        break;
    case 
'expreq':
        
$userinfo['action'] = 'Submitting an Expansion Request';
        
$handled true;
        break;
    case 
'forms':
        
$userinfo['action'] = 'Viewing Forms';
        
$handled true;
        break;
    case 
'pages':
        
$userinfo['action'] = 'Viewing Custom Page';
        
$handled true;
        break;

Currently, for both cases it only recognized the default cast of the switch. My $_GET doesn't seem to be passing the variable to the code, so I am unable to differentiate. Any help would be greatly appreciated!
Reply With Quote
  #2  
Old 07-21-2012, 06:12 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm...I'm not very familiar with that area, but I don't know why what you're doing wouldn't work. But, I see that the rest of the code in that function seems to work with the $userinfo['location'] string and splits the parameters into a $values array, so maybe try doing a switch on $values['pageid'] instead.
Reply With Quote
  #3  
Old 07-21-2012, 06:24 PM
KGodel's Avatar
KGodel KGodel is offline
 
Join Date: May 2011
Location: Indiana
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

And just like that, kh99 does it again. changing from $_GET to $values worked like a charm. You're the best mate!

Edit, you seem to help me so much I can't even like you post, but I really appreciate your help!
Reply With Quote
  #4  
Old 07-21-2012, 08:09 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Glad you got it working. FWIW I realized (I think) why $_GET didn't work - I think that hook is executed when someone else is displaying what the user is doing, not when your pages.php script is executed, so $_GET wouldn't be set at that point.
Reply With Quote
  #5  
Old 07-22-2012, 12:28 AM
KGodel's Avatar
KGodel KGodel is offline
 
Join Date: May 2011
Location: Indiana
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yea that makes sense. I also wasnt sure whether it would be getting it since it was being executed on a different page as well, but the examples I saw elsewhere of people doing this used get, so I tried the same. Good to know though!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:50 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.03972 seconds
  • Memory Usage 2,261KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete