Register Members List Search Today's Posts Mark Forums Read

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

Florida
by noppid noppid is offline 11 Jun 2005

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:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Add the online_location_unknown hook plugin...
Hook Location: online_location_unknown
Name: WOL Online Location Unknown
Active: YES
Code:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


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
Views: 20023
Reply With Quote
Comments
  #2  
Old 11 Jun 2005, 10:12
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Real name: Fillip
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 12 Jun 2005, 00:19
noppid noppid is offline
 
Join Date: Mar 2003
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.
__________________
Add a photo gallery garage to your auto forum and get noticed by your members. Find out how at the vBulletin Computer Help Forum.
An informed rider makes their first destination the motorcycle forum at rider info.
Reply With Quote
  #4  
Old 12 Jun 2005, 17:28
Creative Suite's Avatar
Creative Suite Creative Suite is offline
 
Join Date: May 2004
wow..
__________________
Easy come .. Easy go
:sleep:
Reply With Quote
  #5  
Old 15 Jun 2005, 01:53
merk merk is offline
 
Join Date: Nov 2001
Real name: Tim
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 15 Jun 2005, 09:31
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Real name: Fillip
"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 15 Jun 2005, 10:09
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
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.
__________________
Marco van Herwaarden
Ex vBulletin.org Coordinator
Reply With Quote
  #8  
Old 15 Jun 2005, 11:58
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Real name: Andreas
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 15 Jun 2005, 18:57
noppid noppid is offline
 
Join Date: Mar 2003
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?
__________________
Add a photo gallery garage to your auto forum and get noticed by your members. Find out how at the vBulletin Computer Help Forum.
An informed rider makes their first destination the motorcycle forum at rider info.
Reply With Quote
  #10  
Old 15 Jun 2005, 19:51
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Real name: Fillip
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)
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
  #11  
Old 15 Jun 2005, 19:56
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Real name: Andreas
Try it.
Place a custom hook somewhere between the cases and see what happens
Reply With Quote
  #12  
Old 15 Jun 2005, 20:41
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Real name: Fillip
No. Because if I do that and Im wrong, Im gonna look stupid. So Im right until I am proven wrong from my own attempts, and seeing as I will not attempt it, I am right.
*whistles*
Reply With Quote
  #13  
Old 15 Jun 2005, 20:49
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Real name: Andreas
*G*
OK, I'm gonna try to explain the problem:
If you place a hook somewhere between the cases, it will never be executed - as it would be considered part of the case above the hook.
But this code ends with a break; - and thus the switch() is finished.

Now if you leave out the break; the hook would be executed - but only for this case.
Reply With Quote
  #14  
Old 15 Jun 2005, 20:51
zetetic's Avatar
zetetic zetetic is offline
 
Join Date: Apr 2004
Real name: Tom
Originally Posted by KirbyDE
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.
This seems like the easiest solution to me. Just have one plug-in called "New WOL Entries" that contains its own switch statement, and update it every time you add a new plug-in. I don't see what's wrong with that approach...
Reply With Quote
  #15  
Old 15 Jun 2005, 20:54
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Real name: Andreas
Originally Posted by tmhall
This seems like the easiest solution to me. Just have one plug-in called "New WOL Entries" that contains its own switch statement, and update it every time you add a new plug-in. I don't see what's wrong with that approach...
I've gone one step further and adapted the existing Add WOL Locations from ACP Hack to create/update the necessary hook code automatically, so you can easily add/edit Locations without having to write a single line of PHP Code
Reply With Quote
Reply

Similar Article
Article Author Type Replies Last Post
GTCustom Pages - Create Custom Pages With Ease Princeton vBulletin 3.5 Add-ons 160 17 Jun 2010 23:40



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

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


New To Site? Need Help?

All times are GMT. The time now is 17:14.

Layout Options | Width: Wide Color: