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

Reply
 
Thread Tools Display Modes
  #1  
Old 12-12-2007, 09:22 PM
UberMensch UberMensch is offline
 
Join Date: Jun 2006
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Who's Online Additions

I've got a few custom pages floating around my forum, and I'd like to have them appear properly in the Who's Online (online.php) list.

Editing the functions_online.php is too easy, I'd much rather do it the proper way and use plugins (plus my edits won't be deleted the moment a vBulletin update overwrites the file).

I've done very little work with plugins, but I'm quite confident with php. How would I add custom actions using plugins for the Who's Online list?
Reply With Quote
  #2  
Old 12-13-2007, 05:56 PM
TigerWare TigerWare is offline
 
Join Date: Feb 2007
Location: England, UK
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Go back to looking at the fuctions_online.php (construct_online_bit function) and in the big case statement (default handler) you will ind the following "hook":

PHP Code:
($hook vBulletinHook::fetch_hook('online_location_unknown')) ? eval($hook) : false
If I'm not mistaken you could create a plugin at that location to insert additional criteria for your own custom pages.
Reply With Quote
  #3  
Old 12-13-2007, 09:25 PM
UberMensch UberMensch is offline
 
Join Date: Jun 2006
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've tried that, but with each hook I received a php error stating that the "case" was unexpected.
Reply With Quote
  #4  
Old 12-14-2007, 09:17 AM
TigerWare TigerWare is offline
 
Join Date: Feb 2007
Location: England, UK
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok. Trying to get a handle on how you are coding it.

Here's the default case where the hook sits...
PHP Code:
default:
  
$handled false;
  (
$hook vBulletinHook::fetch_hook('online_location_unknown')) ? eval($hook) : false
I take it by your reply (and the error) that you are simply adding a 'case' in your plugin, like this:-
PHP Code:
case 'something':
// etc... 
So logically this would be interpreted like this:-
PHP Code:
default:
  
$handled false;
  case 
'something':
    
// etc... 
This would be incorrect syntax, and yes, your custom case would not be expected at that location. I think to cure that you would need to expand the plugin code to a full switch statement, or use an if...then construct.

Hows that looking, or have I missed something?
Reply With Quote
  #5  
Old 12-14-2007, 09:23 AM
UberMensch UberMensch is offline
 
Join Date: Jun 2006
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yep that's exactly what I was doing.

I've also tried a number of if statements too, none of which did anything (literally )
Reply With Quote
  #6  
Old 12-14-2007, 04:43 PM
TigerWare TigerWare is offline
 
Join Date: Feb 2007
Location: England, UK
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok,

How about this.

Hook location: online_location_process
Code:
if ($filename == 'yourfile.php')
{
        $userinfo['activity'] = 'yourtitle';
}
and

Hook location: online_location_unknown
Code:
if ($userinfo['activity'] == 'yourtitle')
{
        $userinfo['action'] = 'Viewing Your Page'; 
        $userinfo['where'] = '<a href="./yourfile.php?' . $vbulletin->session->vars['sessionurl'] . '">Your Page</a>'; 
        $handled = true;
}
Might need a little tinkering with the bits in red, but I think that should work.
Reply With Quote
  #7  
Old 12-14-2007, 07:35 PM
UberMensch UberMensch is offline
 
Join Date: Jun 2006
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That worked PERFECTLY! Thanks very, VERY much!
Reply With Quote
  #8  
Old 12-14-2007, 07:45 PM
TigerWare TigerWare is offline
 
Join Date: Feb 2007
Location: England, UK
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Excellent ! :up:
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 08:04 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04112 seconds
  • Memory Usage 2,233KB
  • 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_code
  • (4)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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_postinfo_query
  • fetch_postinfo
  • 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