Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 3 Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
[HowTo] Add Custom Pages to WOL
noppid
Join Date: Mar 2003
Posts: 1,875

 

Florida
Show Printable Version Email this Page Subscription
noppid noppid is offline 06-10-2005, 10:00 PM

I'd like to suggest we follow the the way we did this in the past for the most part. We usually hacked into the two switch statements in the functions_online.php file. So staying with that convention, we can all easily coexist in the two necessary plugins will we need to use to accomplish this.

Why did I say coexist? Well based on this thread, multiple use of hooks, it seems it would be best to share a common plugin to a given hook location for now. That is if I understand it correctly.

So moving right along, this will help you create WOL plugins for your custom pages either way. If we all share a plugin or if we get a system that manages multiple plugins to a given hook, this should be a good example to follow when you need to display custom addin page WOL information.

There are two hook locations we need to add plugins to:
  • vBulletin : Who's Online? -> online_location_process
  • vBulletin : Who's Online? -> online_location_unknown

Add the online_location_process hook plugin...
Hook Location: online_location_process
Name: WOL Online Location Process
Active: YES
Code:
PHP Code:
if($filename=='YOUR_ADDIN_FILE.php'){$userinfo['activity'] = 'YOUR_ACTIVITY';} 

Add the online_location_unknown hook plugin...
Hook Location: online_location_unknown
Name: WOL Online Location Unknown
Active: YES
Code:
PHP Code:
if($userinfo['activity']=='YOUR_ACTIVITY')
{
    
$userinfo['where'] = '<a href="YOUR_ADDIN_FILE.php?'.$vbulletin->session->vars[sessionurl].'">'.$vbulletin->options[bbtitle].' YOUR_ACTIVITY</a>'
    
$userinfo['action'] = 'YOUR_ACTIVITY';
    
$handled true;


Following this convention should allow us to coexist in one plugin for each of those hooks or create good plugins for those hooks, either way.

I hope this is in the spirit of the howto forum and will be useful.

Regards
Reply With Quote
  #2  
Old 06-11-2005, 09:12 AM
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Location: Norway
Posts: 1,671
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for this Howto, I earlier made a request for a new hook location in the middle of the switch() at vBcom, but I guess I can just make myself a new switch inside those 2 locations.
I did think of this myself, but I found it to be a better idea to be able to plugin in the middle of the switch. We'll see what the devs do
Reply With Quote
  #3  
Old 06-11-2005, 11:19 PM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I thought that the logical place for this was in the switch too. But we can accomplish the same thing here.

My initial thought is that a hook in the switch would be more efficient then the bunch of if()'s this may create.

This will evolve. There's always more then one way to skin a cat.
Reply With Quote
  #4  
Old 06-12-2005, 04:28 PM
Creative Suite's Avatar
Creative Suite Creative Suite is offline
 
Join Date: May 2004
Location: Kuwait :)
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

wow..
Reply With Quote
  #5  
Old 06-15-2005, 12:53 AM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by noppid
I thought that the logical place for this was in the switch too. But we can accomplish the same thing here.

My initial thought is that a hook in the switch would be more efficient then the bunch of if()'s this may create.

This will evolve. There's always more then one way to skin a cat.
Im not sure that a hook inside the switch would work how you guys think it will.

You could just add another switch statement in your plugin code instead.

a few ifs wont slow the page down.
Reply With Quote
  #6  
Old 06-15-2005, 08:31 AM
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Location: Norway
Posts: 1,671
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

"a few"? You obviously have not seen the WOL location list for the RPG hack
Not saying it WILL slow it down, just saying that a hook in the middle of the switch as well would be more useful.
Reply With Quote
  #7  
Old 06-15-2005, 09:09 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Revan
"a few"? You obviously have not seen the WOL location list for the RPG hack
Not saying it WILL slow it down, just saying that a hook in the middle of the switch as well would be more useful.
Then please suggest so at vb.com.

PS i agree a hook at that spot would be welcomed.
Reply With Quote
  #8  
Old 06-15-2005, 10:58 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Erm ... you can't put the hook "in the middle of the switch".
You can only put one above it, below, or in one (ore more) of the case: statements - and this is how it does currently work: The hooks are in case default:, eg. will be executed when there is an unknown location.
Now if you have several custom locations put another switch there and everything is just fine.
Reply With Quote
  #9  
Old 06-15-2005, 05:57 PM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I agree, maybe if a plugin has multiple pages to deal with, it should be inside an if() and have it's own switch statement to make it efficient?
Reply With Quote
  #10  
Old 06-15-2005, 06:51 PM
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Location: Norway
Posts: 1,671
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarcoH64
Then please suggest so at vb.com.

PS i agree a hook at that spot would be welcomed.
Been there, done that (quite literally as well)
Quote:
Originally Posted by KirbyDE
Erm ... you can't put the hook "in the middle of the switch".
You can only put one above it, below, or in one (ore more) of the case: statements - and this is how it does currently work: The hooks are in case default:, eg. will be executed when there is an unknown location.
Now if you have several custom locations put another switch there and everything is just fine.
You can put a hook location in the middle of a switch just fine.
Remember before, when we edited the function to put in our own case:'s? That is what I mean. A hook that allows us to add case: instead of switch() in the default:
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 10:00 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.04611 seconds
  • Memory Usage 2,299KB
  • Queries Executed 23 (?)
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
  • (2)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete