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
  #22  
Old 10-07-2005, 07:31 PM
Jenta Jenta is offline
 
Join Date: Dec 2004
Posts: 377
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #23  
Old 11-08-2005, 03:38 PM
dreamer81 dreamer81 is offline
 
Join Date: Jul 2005
Posts: 62
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

uhhhhhh how do I add hooks? or do this???? ???
Reply With Quote
  #24  
Old 02-18-2006, 09:36 PM
MrBen MrBen is offline
 
Join Date: Dec 2004
Location: England
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #25  
Old 04-11-2006, 08:51 AM
IrPr IrPr is offline
 
Join Date: Mar 2005
Posts: 351
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by imported_MrBen
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!
Reply With Quote
  #26  
Old 04-12-2006, 06:00 PM
MrBen MrBen is offline
 
Join Date: Dec 2004
Location: England
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by IrPr
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:
PHP Code:
if ($loc == '/folder/index.php?foo=bar' OR $loc == '/folder/?foo=bar')
{
    
$filename 'foo_bar.php';

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:
PHP Code:
if($filename=='foo_bar.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;

Ben
Reply With Quote
  #27  
Old 09-03-2006, 08:58 PM
phill2003 phill2003 is offline
 
Join Date: Apr 2003
Posts: 217
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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')
{
    $filename = 'index.php';
in the preprocess to hopefully get it to recognose the different index.php but it didnt.
Reply With Quote
  #28  
Old 10-15-2006, 12:29 AM
Antivirus's Avatar
Antivirus Antivirus is offline
 
Join Date: Sep 2004
Location: Black Lagoon
Posts: 1,090
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #29  
Old 10-16-2006, 06:21 AM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for the tutorial.
Reply With Quote
  #30  
Old 10-18-2006, 01:55 AM
ruinernix ruinernix is offline
 
Join Date: Oct 2005
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
require_once('global.php');
require_once(
'includes/functions_user.php');

if(
$vbulletin->userinfo['userid'] > 0
    
$location $vbulletin->db->query_first("SELECT location,sessionhash FROM " TABLE_PREFIX "session WHERE userid = ".$vbulletin->userinfo['userid']." ORDER BY lastactivity DESC LIMIT 1");
else
    
$location $vbulletin->db->query_first("SELECT location,sessionhash FROM " TABLE_PREFIX "session WHERE sessionhash = '".$vbulletin->session->vars['dbsessionhash']."' ORDER BY lastactivity DESC LIMIT 1");

if(
$location['sessionhash'] != "") {
    
$vbulletin->db->query_first("UPDATE " TABLE_PREFIX "session SET location = 'konspiracy.php?"$_SERVER["QUERY_STRING"] ."', lastactivity = '"TIMENOW ."' WHERE sessionhash = '"$location['sessionhash'] ."' LIMIT 1");
} else {
    
$vbulletin->db->query_first("INSERT INTO `session` ( `sessionhash` , `userid` , `host` , `idhash` , `lastactivity` , `location` , `useragent` , `styleid` , `languageid` , `loggedin` , `inforum` , `inthread` , `incalendar` , `badlocation` , `bypass` , `profileupdate` ) 
        VALUES ( '"
$vbulletin->session->vars['dbsessionhash']."', ".$vbulletin->userinfo['userid'].",  '".IPADDRESS."' , '".$vbulletin->session->vars['idhash']."', '".TIMENOW."', 'konspiracy.php?"$_SERVER["QUERY_STRING"] ."', '".$_SERVER["HTTP_USER_AGENT"]."', '0', '0', '1', '0', '0', '0', '0', '0', '0');");

Reply With Quote
  #31  
Old 11-10-2006, 11:09 PM
Antivirus's Avatar
Antivirus Antivirus is offline
 
Join Date: Sep 2004
Location: Black Lagoon
Posts: 1,090
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Ruinerix, i think that will help, going to try it out this weekend.
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 01:26 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
  • Page Generation 0.05019 seconds
  • Memory Usage 2,334KB
  • 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
  • (1)bbcode_code
  • (6)bbcode_php
  • (2)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