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 12-21-2010, 01:12 PM
aileron79 aileron79 is offline
 
Join Date: Apr 2009
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Which hook for users online (online.php)?

Hi everybody,

I want to write a plugin that displays a little flag just beside every user in the user's online list (online.php). I wonder which hook that should be, there is one named online_users on line 511 in online.php, but this seems to be executed only for guests, not for all users:

PHP Code:
395         if ($users['userid'])
...
437         else
438         // Guest or Spider..
...
...
509                 $count++;
510
511                 
($hook vBulletinHook::fetch_hook('online_user')) ? eval($hook) : false;
512         }
513 }
514
515 
if (!$foundviewer AND $vbulletin->userinfo['userid'] AND ($vbulletin->GPC['who'] == '' OR $vbulletin->GPC['who'] == 'members'))
... 
I got a couple of questions:

- Is there a description of all the hooks available?
- What is the meaning of this hook and why is it only executed for guests? Is that a bug, should likes 511 and 512 be swapped?
- Which hook am I supposed to use for that purpose?

Admittedly, I am quite familiar with PHP but not with vB's plugin system. Anyone can provide some information?

Thanks in advance!
Reply With Quote
  #2  
Old 12-21-2010, 01:27 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why don't you just edit the template itself?
Reply With Quote
  #3  
Old 12-21-2010, 03:57 PM
aileron79 aileron79 is offline
 
Join Date: Apr 2009
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo View Post
Why don't you just edit the template itself?
Well, that's basically because the plugin system is there and if possible, I'd prefer to use it - because I (and maybe others) can install and uninstall the whole thing as a product. I wonder if I can make changes to templates by product XML files? (As mentioned before, this probably is a dump question but I'm not yet into this plugin system...)

Editing the template should not be a problem at all, but isn't there a "nicer" way so that my addon/plugin/package/product (however these things are called) can be packed into a single XML file?

Thanks for your answer!
Reply With Quote
  #4  
Old 12-21-2010, 04:07 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can do str_replaces in templates via xml files. I do it all the time. It's a little trickier to do on vb 4 than it was on vb 3, though, when there are raw phrases and variables included. Plus, if you are going to add your own variables, they need to be pre-registered for whatever template you are going to use them in. There are some good articles on that, too.
Reply With Quote
  #5  
Old 12-22-2010, 09:55 AM
aileron79 aileron79 is offline
 
Join Date: Apr 2009
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks heaps, mate!
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 09:18 AM.


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.08118 seconds
  • Memory Usage 2,202KB
  • Queries Executed 11 (?)
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
  • (1)bbcode_php
  • (1)bbcode_quote
  • (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