vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   [HowTo] Add Custom Pages to WOL (https://vborg.vbsupport.ru/showthread.php?t=82882)

noppid 06-10-2005 10:00 PM

[HowTo] Add Custom Pages to WOL
 
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

Revan 06-11-2005 09:12 AM

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 :)

noppid 06-11-2005 11:19 PM

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. ;)

Creative Suite 06-12-2005 04:28 PM

wow..

merk 06-15-2005 12:53 AM

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.

Revan 06-15-2005 08:31 AM

"a few"? You obviously have not seen the WOL location list for the RPG hack :p
Not saying it WILL slow it down, just saying that a hook in the middle of the switch as well would be more useful.

Marco van Herwaarden 06-15-2005 09:09 AM

Quote:

Originally Posted by Revan
"a few"? You obviously have not seen the WOL location list for the RPG hack :p
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.

Andreas 06-15-2005 10:58 AM

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.

noppid 06-15-2005 05:57 PM

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?

Revan 06-15-2005 06:51 PM

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:


All times are GMT. The time now is 01:20 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.02687 seconds
  • Memory Usage 1,747KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete