PDA

View Full Version : [HowTo] Add Custom Pages to WOL


noppid
11 Jun 2005, 06:55
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 (http://www.vbulletin.org/forum/showthread.php?t=82760), 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:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




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


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




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
11 Jun 2005, 11:12
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
12 Jun 2005, 01:19
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
12 Jun 2005, 18:28
wow..

merk
15 Jun 2005, 02:53
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
15 Jun 2005, 10:31
"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
15 Jun 2005, 11:09
"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
15 Jun 2005, 12:58
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
15 Jun 2005, 19:57
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
15 Jun 2005, 20:51
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) ;)
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:

Andreas
15 Jun 2005, 20:56
Try it.
Place a custom hook somewhere between the cases and see what happens ;)

Revan
15 Jun 2005, 21:41
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*

Andreas
15 Jun 2005, 21:49
*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.

zetetic
15 Jun 2005, 21:51
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...

Andreas
15 Jun 2005, 21:54
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 :)

zetetic
15 Jun 2005, 21:56
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 :)
Oh cool. I didn't even know that hack existed. :)

Dream
03 Aug 2005, 06:26
shouldnt process be setting the info and location unknown choosing the activity

Jako
04 Aug 2005, 07:06
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.

GilbertZ
29 Aug 2005, 00:30
Thanks for the how to.
1.
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 :)
Could you provide the url please :)

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?




Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Andreas
29 Aug 2005, 04:31
1. => See my Profile

Jenta
07 Oct 2005, 21:31
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?

dreamer81
08 Nov 2005, 17:38
uhhhhhh how do I add hooks? or do this???? ???

MrBen
18 Feb 2006, 23:36
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

IrPr
11 Apr 2006, 10:51
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
Me Too!

MrBen
12 Apr 2006, 20:00
Me Too!
This is what I did in the end... It's basically the same as the OP but you add some code in another hook.


There are three hook locations we need to add plugins to:

vBulletin : Who's Online? -> online_location_preprocess
vBulletin : Who's Online? -> online_location_process
vBulletin : Who's Online? -> online_location_unknown


Add the online_location_preprocess hook plugin...
Hook Location: online_location_preprocess
Name: WOL Online Location PreProcess
Active: YES
Code:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



The rest is the same as the OP but I'll post it here for completeness...

Add the online_location_process hook plugin...
Hook Location: online_location_process
Name: WOL Online Location Process
Active: YES
Code:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




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


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Ben

phill2003
03 Sep 2006, 22:58
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:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



in the preprocess to hopefully get it to recognose the different index.php but it didnt.

Antivirus
15 Oct 2006, 02:29
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?

harmor19
16 Oct 2006, 08:21
Thank you for the tutorial.

ruinernix
18 Oct 2006, 03:55
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.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Antivirus
11 Nov 2006, 01:09
Thanks Ruinerix, i think that will help, going to try it out this weekend.

Jon_Simmonds
03 Mar 2007, 21:25
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?

Dream
24 Mar 2007, 22:40
I know you won't see this, but thank you worked like a charm :)

ArnyVee
08 Dec 2008, 05:53
Is this method still the way to go?

Just making sure before I do some work on my custom pages :D

vietfancy
12 Jan 2009, 20:21
Now that i can do something with my board.

Thanks

shooterdfl
30 Mar 2009, 00:44
Thanks for this, it works fine with the army and vbadvanced cmps mods. Using vbulletin 3.8.1.P1

HG-ILUSION
09 May 2009, 03:37
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.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



How I can use this?

It says "Unknow location" but it works.

Thanks

MagicThemeParks
21 Sep 2009, 00:24
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:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



....any ideas/suggestions on what I can do to fix this?