vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   Display Users Viewing non-vBulletin Pages in "Online Users" (https://vborg.vbsupport.ru/showthread.php?t=157329)

NeutralizeR 09-07-2007 10:00 PM

Display Users Viewing non-vBulletin Pages in "Online Users"
 
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 - https://vborg.vbsupport.ru/external/2007/09/36.gif this image at the footer is called by iframe 'extra_online_users.php')

The viewer is displayed as:
https://vborg.vbsupport.ru/external/2007/09/2.png

Feel free to ask any questions realated to this tutorial.

Display Users Viewing non-vBulletin Pages in "Online Users" tutorial by NeutralizeR @ MsXLabs

foxfirediego 09-13-2007 10:01 AM

very nice... thanks for sharing!

TigerWare 09-13-2007 07:59 PM

This is quite interesting, thanks for this.

I was wondering whether you could modify this technique to only use a single page (the one that is loaded into the IFRAME in the non-vB pages).

The url to the page can have a parameter...

So instead of loading this:-
HTML Code:

src="http://www.yourdomain.com/extra_online_users.php"
Could you do this:-
HTML Code:

src="http://www.yourdomain.com/extra_online_users.php?id=mypage1"
src="http://www.yourdomain.com/extra_online_users.php?id=mypage2"

etc...

Is it then possible to identify the parameter (query string) in the URL from within the plugin and save replicating the 'extra_online_users.php' page over and over?

No idea if this could work, just thinking out loud.

:up:

NeutralizeR 09-13-2007 08:41 PM

It needs a little programming. Why don't you simply use the main site title of the external pages? For example "Viewing Blog Pages, Viewing XXX Website Pages..." or you can use "Viewing a custom page of -yourforumtile-". Sorry, that's all i can suggest at the moment :)

Jase2 12-31-2007 01:24 PM

Hi,

Thanks for this tutorial.

However i have tried it and it doesnt work for me.

Have have done what you have said and i have actived the plugins

NeutralizeR 12-31-2007 01:36 PM

Quote:

Originally Posted by Jase2 (Post 1412631)
Hi,

Thanks for this tutorial.

However i have tried it and it doesnt work for me.

Have have done what you have said and i have actived the plugins

How did you test it? Open the custom page with another account (a guest account maybe) and check his location at the online users list. Mouse over the question mark icon, it'll tell you the full path.

Jase2 12-31-2007 02:41 PM

Thats what iv done.

This is the full location http://www.thecomputerforumz.com/vbtest/donation.php which is right.

I have changed the url and the name that i want it to show up with as well

CrashPush 06-25-2008 04:55 PM

I will give this a go.

Alfa1 07-16-2008 12:53 AM

Many thanks for this article!
Quote:

Originally Posted by NeutralizeR (Post 1334879)
Let's say you have a page nothing to do with vBulletin & vBulletin database

What if the pages are generated by a non-vb program that is installed in the same database as vbulletin? Would the same approach apply?

NeutralizeR 07-16-2008 08:32 AM

Quote:

Originally Posted by Alfa1 (Post 1576419)
Many thanks for this article!

What if the pages are generated by a non-vb program that is installed in the same database as vbulletin? Would the same approach apply?

Any page you can call extra_online_users.php via iframe is okay. (Wordpress, Mediawiki... etc)


All times are GMT. The time now is 11:21 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.01278 seconds
  • Memory Usage 1,769KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_html_printable
  • (4)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete