Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 3 Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Display Users Viewing non-vBulletin Pages in "Online Users"
NeutralizeR
Join Date: Aug 2005
Posts: 355

 

Show Printable Version Email this Page Subscription
NeutralizeR NeutralizeR is offline 09-07-2007, 10:00 PM

Hi,

I had some non-vBulletin pages integrated to the vb database and i wanted to show the users viewing those pages in Online Users so i used this piece of code at the top of the non-vBulletin pages:

PHP Code:
<?php

error_reporting
(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS'1);
define('THIS_SCRIPT''adv_index');
define('VBA_PORTAL'true);
define('VBA_SCRIPT''CMPS');

$forumpath 'yourforumpath';

//example = '/home/msxorg/public_html/forum'

chdir($forumpath);

$phrasegroups = array();
$globaltemplates = array();
$actiontemplates = array();
$specialtemplates = array();

require_once(
'./includes/vba_cmps_include_template.php');
require_once(
'./global.php');

exec_shut_down();
?>
You can remove the lines related to vBadvanced if you don't have it installed.

More information can be found here:

How to create your own vBulletin-powered page! (uses vB templates)


-----------------------------------------------------------------------------

Let's say you have a page nothing to do with vBulletin & vBulletin database (wordpress pages, external html pages, even pages of your other domains etc...) and you still want to show the page viewers in Online Users of vBulletin.


Step - 1


Create a page called 'extra_online_users.php'.

Copy these lines in it:
PHP Code:
<?php

error_reporting
(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS'1);

$forumpath 'yourforumpath';
//example = '/home/msxorg/public_html/forum'

chdir($forumpath);

$phrasegroups = array();
$globaltemplates = array();
$actiontemplates = array();
$specialtemplates = array();

require_once(
'./global.php');


exec_shut_down();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Extra Online Users</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="content-language" content="en" />
</head>
<body style="margin: 0px">
<!-- anything can be put here. a little image, some text, etc... or you may keep it like this -->
</body>
</html>
Save and upload this page to your domain or forum root.

Step - 2

Open your non-vbulletin page and copy these lines to the very bottom of your page:
(Note: Before </body>)

HTML Code:
<iframe src="http://www.yourdomain.com/extra_online_users.php" scrolling="no" allowtransparency="true" frameborder="0" width="0" height="0"></iframe>
Now, anybody visits your non-vbulletin page will be displayed at "Online Users".

But it will show their location as "Unknown Location". We can fix this of course.

Step - 3

Go to your AdminCP > Plugins & Products > Plugin Manager > Add new Plugin

Product: vBulletin
Hook Location: online_location_process
Title: Extra Online Users Process
Execution Order: 5

Code:
PHP Code:
if ($filename == 'extra_online_users.php')
{
    
$userinfo['activity'] = 'extra_online_users';

Save.

Go to your AdminCP > Plugins & Products > Plugin Manager > Add new Plugin

Product: vBulletin
Hook Location: online_location_unknown
Title: Extra Online Users Unknown
Execution Order: 5

Code:
PHP Code:
if ($userinfo['activity'] == 'extra_online_users')
{
    
$handled true;
    
$userinfo['action'] = 'Viewing -your custom page title comes here-';
    
$userinfo['where'] = '<a href="http://-your custom page url comes here-">-your custom page title-</a>';

Save.

If you want to apply this tutorial for more than one page, just create another instance of "extra_online_users.php" and name it like "extra_online_users2.php".

Don't forget to add the lines to the plugins and make the name changes.

Demo and screenshots:
Messenger Blog
(a wordpress blog - this image at the footer is called by iframe 'extra_online_users.php')

The viewer is displayed as:


Feel free to ask any questions realated to this tutorial.

Display Users Viewing non-vBulletin Pages in "Online Users" tutorial by NeutralizeR @ MsXLabs
Reply With Quote
  #12  
Old 07-16-2008, 11:37 AM
Stryker412 Stryker412 is offline
 
Join Date: May 2005
Posts: 326
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Does this work with custom vba pages?
Reply With Quote
  #13  
Old 07-16-2008, 01:35 PM
NeutralizeR NeutralizeR is offline
 
Join Date: Aug 2005
Posts: 355
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Stryker412 View Post
Does this work with custom vba pages?
Yes, as long as you include the iframe on the page.
Reply With Quote
  #14  
Old 07-16-2008, 02:35 PM
Stryker412 Stryker412 is offline
 
Join Date: May 2005
Posts: 326
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm, the way I did it now is from bbcode. Would I have to adjust for an html page?

http://www.shatteredplanet.org/index...d=serverstatus
Reply With Quote
  #15  
Old 07-16-2008, 04:33 PM
NeutralizeR NeutralizeR is offline
 
Join Date: Aug 2005
Posts: 355
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Stryker412 View Post
Hmm, the way I did it now is from bbcode. Would I have to adjust for an html page?

http://www.shatteredplanet.org/index...d=serverstatus
Not sure how you did it. It should be ok if the php contents are being executed.
Reply With Quote
  #16  
Old 07-16-2008, 05:21 PM
Stryker412 Stryker412 is offline
 
Join Date: May 2005
Posts: 326
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I did my page by going in to Add Page, then bb code page.

Edit: Ok I recreated my page using the HTML template method in vba but following your tutorial. I've done all the steps but users are still showing as:
Unknown Location
/forum/extra_online_users.php


Here is the new page:

http://www.shatteredplanet.org/index.php?pageid=servers
Reply With Quote
  #17  
Old 07-16-2008, 06:28 PM
NeutralizeR NeutralizeR is offline
 
Join Date: Aug 2005
Posts: 355
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Stryker412 View Post
I did my page by going in to Add Page, then bb code page.

Edit: Ok I recreated my page using the HTML template method in vba but following your tutorial. I've done all the steps but users are still showing as:
Unknown Location
/forum/extra_online_users.php


Here is the new page:

http://www.shatteredplanet.org/index.php?pageid=servers
Oh, sorry. The file must be different. I mean both index.php or index.php?pageid are same for this script. Maybe you should check vBadvanced support forums.
Reply With Quote
  #18  
Old 07-16-2008, 06:38 PM
Stryker412 Stryker412 is offline
 
Join Date: May 2005
Posts: 326
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well the second method I did for a page just uses a html file and displays it within VBa, so your directions should work.

If you view just the source page: http://www.shatteredplanet.org/forum/serverstatus.html

You still get unknown location.

I have the plugin code as:

Code:
if ($userinfo['activity'] == 'extra_online_users')
{
    $handled = true;
    $userinfo['action'] = 'Viewing Server Status';
    $userinfo['where'] = '<a href="http://www.shatteredplanet.org/index.php?pageid=servers">servers</a>';
}
Reply With Quote
  #19  
Old 07-21-2008, 12:05 PM
Stryker412 Stryker412 is offline
 
Join Date: May 2005
Posts: 326
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Any help Neutralize?
Reply With Quote
  #20  
Old 07-21-2008, 04:26 PM
NeutralizeR NeutralizeR is offline
 
Join Date: Aug 2005
Posts: 355
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Stryker412 View Post
Any help Neutralize?
Then it must be:
Code:
$userinfo['where'] = '<a href="http://www.shatteredplanet.org/forum/serverstatus.html">servers</a>';
Reply With Quote
  #21  
Old 07-21-2008, 04:36 PM
Stryker412 Stryker412 is offline
 
Join Date: May 2005
Posts: 326
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by NeutralizeR View Post
Then it must be:
Code:
$userinfo['where'] = '<a href="http://www.shatteredplanet.org/forum/serverstatus.html">servers</a>';
No change, still says unknown location.

--------------- Added [DATE]1216663563[/DATE] at [TIME]1216663563[/TIME] ---------------

Here is the entire text of my html file:

Code:
<br>
<center><a href="http://www.gametracker.com/server_info/208.122.57.234:3658/" target="_blank">
<img src="http://cache.www.gametracker.com/server_info/208.122.57.234:3658/b_560x95.png" border="0" />
</a></center>
<br>
<center><a href="http://www.gametracker.com/server_info/208.122.57.234:16567/" target="_blank">
<img src="http://cache.www.gametracker.com/server_info/208.122.57.234:16567/b_560x95.png" border="0" />
</a></center>
<br>
<center><a href="http://www.gametracker.com/server_info/64.34.165.20:8855/" target="_blank">
<img src="http://cache.www.gametracker.com/server_info/64.34.165.20:8855/b_560x95.png" border="0" />
</a></center>
<iframe src="http://www.shatteredplanet.org/forum/extra_online_users.php" scrolling="no" allowtransparency="true" frameborder="0" width="0" height="0"></iframe>
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 08:01 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.04838 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
  • (4)bbcode_code
  • (1)bbcode_html
  • (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