PDA

View Full Version : Display Users Viewing non-vBulletin Pages in "Online Users"


NeutralizeR
08 Sep 2007, 16:00
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

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) (http://www.vbulletin.org/forum/showthread.php?t=62164)


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

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

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>)

<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: 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: 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 (http://msn-live-messenger.msxlabs.org/)
(a wordpress blog - https://www.vbulletin.org/forum/external/2007/09/36.gif this image at the footer is called by iframe 'extra_online_users.php')

The viewer is displayed as:
https://www.vbulletin.org/forum/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 (http://www.msxlabs.org/forum/members/1-neutralizer.html) @ MsXLabs (http://www.msxlabs.org)

foxfirediego
13 Sep 2007, 11:01
very nice... thanks for sharing!

TigerWare
13 Sep 2007, 20:59
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:-
src="http://www.yourdomain.com/extra_online_users.php"

Could you do this:-
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
13 Sep 2007, 21:41
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
31 Dec 2007, 14:24
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
31 Dec 2007, 14:36
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
31 Dec 2007, 15:41
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
25 Jun 2008, 17:55
I will give this a go.

Alfa1
16 Jul 2008, 01:53
Many thanks for this article!
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
16 Jul 2008, 09:32
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)

Stryker412
16 Jul 2008, 12:37
Does this work with custom vba pages?

NeutralizeR
16 Jul 2008, 14:35
Does this work with custom vba pages?
Yes, as long as you include the iframe on the page.

Stryker412
16 Jul 2008, 15:35
Hmm, the way I did it now is from bbcode. Would I have to adjust for an html page?

http://www.shatteredplanet.org/index.php?pageid=serverstatus

NeutralizeR
16 Jul 2008, 17:33
Hmm, the way I did it now is from bbcode. Would I have to adjust for an html page?

http://www.shatteredplanet.org/index.php?pageid=serverstatus
Not sure how you did it. It should be ok if the php contents are being executed.

Stryker412
16 Jul 2008, 18:21
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

NeutralizeR
16 Jul 2008, 19:28
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.

Stryker412
16 Jul 2008, 19:38
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:

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>';
}

Stryker412
21 Jul 2008, 13:05
Any help Neutralize?

NeutralizeR
21 Jul 2008, 17:26
Any help Neutralize?
Then it must be:

$userinfo['where'] = '<a href="http://www.shatteredplanet.org/forum/serverstatus.html">servers</a>';

Stryker412
21 Jul 2008, 17:36
Then it must be:

$userinfo['where'] = '<a href="http://www.shatteredplanet.org/forum/serverstatus.html">servers</a>';

No change, still says unknown location.

--------------- Added 1216663563 at 1216663563 ---------------

Here is the entire text of my html file:

<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>

Stryker412
28 Jul 2008, 12:40
bump

NeutralizeR
28 Jul 2008, 15:12
bump
Create a new template module @ vBadvanced, copy the <iframe> code in that template.

Stryker412
28 Jul 2008, 15:21
I created the same page without using vbadvanced but I was still able to get the error. See here:

http://www.shatteredplanet.org/forum/serverstatus.html

NeutralizeR
28 Jul 2008, 16:45
Try recreating the plugins at Step 3.

Stryker412
28 Jul 2008, 16:56
Ok I found the issue, thank you very much for your support!

Dave-ahfb
10 Mar 2009, 14:49
How is this with 3.8.1?

yahoooh
02 Sep 2009, 22:46
How is this with 3.8.1?

yes it works

also:

i added it on my site with clipshare
is there any way to make where exactly the user visit
for example :
when he visit video link
when he visit main page
when he visit tags ..etc

is there away to make it give some more info

Ingenious
21 Sep 2009, 14:18
I just wanted to say thanks for this article, I have added this to my site so a non-VB page shows up on who's on-line. The other articles I found were a bit out of date.

Just to clarify (as it confused me a bit to start with) to get a non-VB page to show on your on-line list, do the very first step as shown (cut and paste that code into the top of your file), but remove the VBA_ bits if you don't have VB Advance plugged in. In that case also remove the require_once('./includes/vba_cmps_include_template.php'); line too.

Then jump to step 3 to do the plugin bits, changing the code as required so it matches your filename.

Ideally you need to do this with two PC's running so you can log into the on-line list as a guest, to see yourself on the page. Otherwise when you access your non-VB page (remember to refresh it!) then go to who's on-line, it will show you as browsing who's on-line.

Anyway thanks again to the OP and other people who posted here.

PS. Working for me on 3.8.4

peleh
27 Sep 2009, 04:43
On 'extra_online_users.php, i have to edit the line $forumpath = 'yourforumpath'; with my forum path?

Edit, nevermind, its working now.

Xencored
05 Feb 2010, 00:54
Hey

Can only get it to show "Unknown location" everythign else works spot on and thanks!!


if ($userinfo['activity'] == 'extra_online_users')
{
$handled = true;
$userinfo['action'] = 'Viewing The Gallery!';
}

Malcolm-X
19 Nov 2011, 22:12
not worked for me:(