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
  #12  
Old 06-15-2005, 06:56 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try it.
Place a custom hook somewhere between the cases and see what happens
Reply With Quote
  #13  
Old 06-15-2005, 07:41 PM
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Location: Norway
Posts: 1,671
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
  #14  
Old 06-15-2005, 07:49 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

*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
  #15  
Old 06-15-2005, 07:51 PM
zetetic's Avatar
zetetic zetetic is offline
 
Join Date: Apr 2004
Posts: 338
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
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
  #16  
Old 06-15-2005, 07:54 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
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
  #17  
Old 06-15-2005, 07:56 PM
zetetic's Avatar
zetetic zetetic is offline
 
Join Date: Apr 2004
Posts: 338
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KirbyDE
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.
Reply With Quote
  #18  
Old 08-03-2005, 04:26 AM
Dream's Avatar
Dream Dream is offline
 
Join Date: Oct 2001
Posts: 2,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

shouldnt process be setting the info and location unknown choosing the activity
Reply With Quote
  #19  
Old 08-04-2005, 05:06 AM
Jako Jako is offline
 
Join Date: Sep 2004
Location: Michigan
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #20  
Old 08-28-2005, 10:30 PM
GilbertZ GilbertZ is offline
 
Join Date: Nov 2004
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the how to.
1.
Quote:
Originally Posted by KirbyDE
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?

Quote:
Originally Posted by noppid
PHP Code:
if($filename=='YOUR_ADDIN_FILE.php'){$userinfo['activity'] = 'YOUR_ACTIVITY';} 
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;

Reply With Quote
  #21  
Old 08-29-2005, 02:31 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

1. => See my Profile
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 03:10 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.05242 seconds
  • Memory Usage 2,320KB
  • Queries Executed 25 (?)
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
  • (4)bbcode_php
  • (5)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
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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