[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:
Add the online_location_process hook plugin... Hook Location: online_location_process Name: WOL Online Location Process Active: YES Code: PHP Code:
Add the online_location_unknown hook plugin... Hook Location: online_location_unknown Name: WOL Online Location Unknown Active: YES Code: PHP 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 |
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 :) |
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. ;) |
wow..
|
Quote:
You could just add another switch statement in your plugin code instead. a few ifs wont slow the page down. |
"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. |
Quote:
PS i agree a hook at that spot would be welcomed. |
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. |
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?
|
Quote:
Quote:
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: |
Try it.
Place a custom hook somewhere between the cases and see what happens ;) |
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* |
*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. |
Quote:
|
Quote:
|
Quote:
|
shouldnt process be setting the info and location unknown choosing the activity
|
I'm a bit confused on exactly where I need to add those lines of code. I'm currently using 3.0.8 so if anyone knows exactly where to add those lines of php code, I would really appreciate it.
|
Thanks for the how to.
1. Quote:
2. Jako, this is for 3.50. Doesn't work for 3.08. 3. One question about this how to. Is the "Activity" a phrase? Can you provide an example of what "YOUR_ACTIVITY" would look like? Quote:
|
1. => See my Profile
|
seems u cant do phrasing in...
$userinfo['where'] = '<a href="YOUR_ADDIN_FILE.php?'.$vbulletin->session->vars[sessionurl].'">'.$vbulletin->options[bbtitle].PHRASE</a>'; unless someone wants to explain to me how you can use them under viewing blah(the description) though ps. can someone delete all the redirects in here? |
uhhhhhh how do I add hooks? or do this???? ???
|
How would I go about adding a custom WOL line for a URL like somepage.php?foo=bar
$filename only contains somepage.php so is there another variable that contains the querystring? Thanks, Ben |
Quote:
|
Quote:
There are three hook locations we need to add plugins to:
Add the online_location_preprocess hook plugin... Hook Location: online_location_preprocess Name: WOL Online Location PreProcess Active: YES Code: PHP Code:
Add the online_location_process hook plugin... Hook Location: online_location_process Name: WOL Online Location Process Active: YES Code: PHP Code:
Add the online_location_unknown hook plugin... Hook Location: online_location_unknown Name: WOL Online Location Unknown Active: YES Code: PHP Code:
|
Hi,
This is brill but i have a question if i may. How do i go about giving seperate locations if 2 files share the same name. i have a gallery with an index.php and the whos online gives the location as the home page because thats index as well. I tried this. Code:
if ($loc == '/folder/index.php') |
One thing I notice about this is it only seems to work when the user is logged in, otherwise if it's a guest viewing a custom page, it just says "Viewing Index". Is there any way to get it to show custom locations for guests as well?
|
Thank you for the tutorial.
|
I coded this to show my index.php properly, so I don't have to edit vb's code.. may have to customize it for your own needs ;) it's working for me... so I can show my pages from index.php and use hooks to properly name/show them. Hope it helps.
PHP Code:
|
Thanks Ruinerix, i think that will help, going to try it out this weekend.
|
I have a couple of scripts I want to link to my WOL but the scripts are in subdomains, any suggestions or pointers on how to write the WOL plugin for this to work?
|
I know you won't see this, but thank you worked like a charm :)
|
Is this method still the way to go?
Just making sure before I do some work on my custom pages :D |
Now that i can do something with my board.
Thanks |
Thanks for this, it works fine with the army and vbadvanced cmps mods. Using vbulletin 3.8.1.P1
|
Quote:
It says "Unknow location" but it works. Thanks |
I just followed the instructions and added the two plugins, but when I refresh the "Who's Online", it gives me a white screen with the following error....
Code:
Error 2 (net::ERR_FAILED): Unknown error. |
All times are GMT. The time now is 08:30 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 | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|