PDA

View Full Version : [RELEASE] User Online In Users Thread


01-15-2001, 04:50 AM
This is a small (very small) Hack i made today. Its like ubb's UBonline.cgi hack. so small anyone could install it

Step 1
Open showthread.php/php3 and find

$userid=$post[userid];

if ($userid!=0) {
$userinfo=$post;

and UNDER it add


// User Online Icon Hack by Chris Boulton
$status = $DB_site->query_first("SELECT session.userid,user.username,user.receivepm FROM session, user WHERE session.userid=user.userid AND session.userid='".intval($userinfo[userid])."'");
if ($status) {
$usersstatus = "<img src=\"images/online.gif\" border=0 alt=\"$userinfo[username] is Online\">";
} else {
$usersstatus = "<img src=\"images/offline.gif\" border=0 alt=\"$userinfo[username] is Offline\">";
}
// User Online Icon Hack by Chris Boulton


Step 2
save and upload

Step 3
open your postbit template
and instert $usersstatus where you want to display if the threads poster is online or offline

Step 4
download or make 2 images (offline.gif and online.gif)
I use the ones that ubbdev.com use

Please be nice on me, this is the first hack i have made for vBulletin. If someone has already done it sorry.

BTW - does anyone want to help me with a Instant Message Hack, i am crap at php but i have done the templates etc etc.


If you have trouble with this hack reply or contact me

01-15-2001, 04:54 AM
thx for the great hack :) no problems so far.....guess i need to install it first :p

01-15-2001, 05:12 AM
i can tell you it works on my vBulletin. no demo sorry

01-15-2001, 11:12 AM
2 comments....

1) This is already included as a feature in version 2.0 of vBulletin.

2) Private messaging is included as a hack now and as a standard feature in version 2.0

01-15-2001, 03:42 PM
And this will add a query per post. It'd be more efficient to join it with the big query.

01-15-2001, 04:50 PM
I agree.

I will wait till a better optimized version of this hack comes out before adding it...or wait till 2.0. :)

Thanks for the hack though surfichris.

01-15-2001, 07:18 PM
works great but here are some little improvments:
to make the online icon a link to the onlineusers hack change this:
$usersstatus = "<img src=\"images/online.gif\" border=0 alt=\"$userinfo[username] is Online\">";
to:
$usersstatus = "<a href=\"whoisonline.php?action=onlineusers\"><img src=\"images/online.gif\" border=0 alt=\"$userinfo[username] is Online\"></a>";

to see if the user is online on the memberlist:
open memberlist.php.
look for $posts = $user[posts];
(at the start)
and After it add:
// User Online Icon Hack by Chris Boulton
$status = $DB_site->query_first("SELECT session.userid,user.username,user.receivepm FROM session, user WHERE session.userid=user.userid AND session.userid='".intval($userinfo[userid])."'");
if ($status) {
$usersstatus = "<a href=\"whoisonline.php?action=onlineusers\"><img src=\"images/online.gif\" border=0 alt=\"$userinfo[username] is Online\"></a>";
} else {
$usersstatus = "<img src=\"images/offline.gif\" border=0 alt=\"$userinfo[username] is Offline\">";
}
// User Online Icon Hack by Chris Boulton

then goto memberlist template:
Find:
<td align="center" bgcolor="{tableheadbgcolor}"><smallfont color="{tableheadtextcolor}"><b>Number Of Posts
</b></smallfont></td>
After, Add:

<td align="center" bgcolor="{tableheadbgcolor}"><smallfont color="{tableheadtextcolor}"><b>Status</b></smallfont></td>
</tr>

Then Goto memberlistbit
look for:

<td bgcolor="{firstaltcolor}" align="center"><normalfont>$posts</normalfont></td>

After Add:
<td bgcolor="{secondaltcolor}" align="center"><normalfont>$usersstatus </normalfont></td>

Thats all

Update:
Sorry im having troble with the second improvment that It shows all the users as offline.
anyone can help?

01-16-2001, 12:12 AM
i know it will be in 2.0 but i started to miss UBB (kinda) so i made this.

I just made something simple becuase i'm pretty crap and don't know much php.

Any way, thanks for your comments and thanks for the enhancments

01-16-2001, 12:32 AM
Originally posted by wluke
2 comments....


2) Private messaging is included as a hack now and as a standard feature in version 2.0

I know about private messaging instant messaging is different
http://matt2004.com/cgi-bin/ubb/postdisplay.cgi?forum=Forum1&topic=000001 click my status (online/offline)

01-16-2001, 08:27 AM
on line
http://www.f0f.net/vb/images/online.gif
off line
http://www.f0f.net/vb/images/offline.gif

01-16-2001, 04:45 PM
well I dunno y all these peeps r dissing it, but i happen to like it a lot! thanks!

01-17-2001, 03:31 AM
i don't know if it's just me.......but this hack doesn't seem to to work in vbb1.15......whenever i add it it shows a database error.....has anyone using vbb1.15 get this hack to work??

01-17-2001, 04:06 AM
No one is dissing it. I think its a great hack...but I'm all for improving it and making it easier on my server load.

:)

01-17-2001, 04:31 AM
works great on 1.14, will try on 1.15 later.

whats the error you get

01-17-2001, 05:52 AM
Anyway to Optimize this like Ed Sullivan suggested?

01-17-2001, 01:39 PM
Originally posted by VirtueTech
Anyway to Optimize this like Ed Sullivan suggested?

Sure you could do it like I have done it in v2.0 :)

01-18-2001, 12:53 AM
well......everything works fine until i click on one of the threads, then it showed up a page that said there was some database error......

01-21-2001, 08:11 AM
I get same error with 1.1.5

Unless anything here is wrong

$userid=$post[userid];

if ($userid!=0) {
$userinfo=$post;
// User Online Icon Hack by Chris Boulton
$status = $DB_site->query_first("SELECT session.userid,user.username,user.receivepm FROM session, user WHERE session.userid=user.userid AND session.userid='".intval($userinfo[userid])."'");
if ($status) {
$usersstatus = "<img src=\"images/online.gif\" border=0 alt=\"$userinfo[username] is Online\">";
} else {
$usersstatus = "<img src=\"images/offline.gif\" border=0 alt=\"$userinfo[username] is Offline\">";
}
// User Online Icon Hack by Chris Boulton
$username=htmlspecialchars($userinfo[username]);
$searchuser=urlencode($userinfo[username]);
//star hack
if ($userinfo[usertitle]=="Administrator") {

01-24-2001, 02:02 AM
Hey Scaramanga

I like the addition but here is your problem for the all offline problem

PS

This work for 1.1.5
just make sure you have the whos online hack.


// User Online Icon Hack by Chris Boulton
$status = $DB_site->query_first("SELECT session.userid,user.username,user.receivepm FROM session, user WHERE session.userid=user.userid AND session.userid='".intval($user[userid])."'");
if ($status) {
$usersstatus = "<a href=\"whoisonline.php3?action=onlineusers\"><img src=\"images/online.gif\" border=0 alt=\"$user[username] is Online\"></a>";
} else {
$usersstatus = "<img src=\"images/offline.gif\" border=0 alt=\"$user[username] is Offline\">";
}
// User Online Icon Hack by Chris Boulton

01-24-2001, 03:02 AM
Sure you could do it like I have done it in v2.0 :) [/B]

How would that be freddie? :)

01-24-2001, 03:03 AM
You have the join the post.userid with the session table to see if the user is online. That is why I have made it an optional feature as it will add query time to showthread.

02-21-2001, 03:47 AM
===== > showthread.php/php3

==== > Find
require("global.php");

====>Add below
// on line hack
if ($displayloggedin==1) {
$datecut=time()-$cookietimeout;

$numberguest=0;
$numberregistered=0;
if ($logged=$DB_site->query("SELECT userid FROM session")) {
while($thislogged=$DB_site->fetch_array($logged)) {
if ($thislogged[userid]==0) {
$numberguest++;
} else {
$numberregistered++;
}
}
}
$totalonline = $numberguest+$numberregistered;

$numbervisible=0;
$activeusers = "";
$loggedins=$DB_site->query("SELECT DISTINCT user.userid,username,session.location FROM user,session WHERE session.userid=user.userid AND session.userid<>0 AND invisible=0 ORDER BY username");
if ($loggedin=$DB_site->fetch_array($loggedins)) {
$numbervisible++;
$userid=$loggedin[userid];
$username=$loggedin[username];
$location=$loggedin[location];

eval("\$activeusers .= \"on line - ".gettemplate("loggedinuser")."\";");

while ($loggedin=$DB_site->fetch_array($loggedins)) {
$numbervisible++;
$userid=$loggedin[userid];
$username=$loggedin[username];
$location=$loggedin[location];
eval("\$activeusers .= \", ".gettemplate("loggedinuser")."\";");
}
}
$numberinvisible=$numberregistered-$numbervisible;
eval("\$loggedinusers = \"".gettemplate("loggedinusers")."\";");
}

// end on line hack

====>Save and upload this file

====> In "showthread" template:

==== > Find
$nextnewest</smallfont></TD>
</tr>
</table>

====>Add below

<tr bgcolor="{categorybackcolor}"><td colspan=6>
<smallfont>$activeusers</smallfont></td>
</tr>
Save template

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

test
http://www.f0f.net/vb/showthread.php3?threadid=54

02-21-2001, 10:53 AM
i did a similar hack for 1.x but i added the db-queries to existing queries so that there wont be an extra query(load) to the database.

02-27-2001, 04:57 PM
2 comments....

1) This is already included as a feature in version 2.0 of vBulletin.

2) Private messaging is included as a hack now and as a standard feature in version 2.0

But it does not show if they are online in the message board where the person made the message?

02-28-2001, 03:37 AM
Originally posted by philliplewis
2 comments....

1) This is already included as a feature in version 2.0 of vBulletin.

I know, who said it was for 2 it is for the version 1 series

Originally posted by philliplewis

2) Private messaging is included as a hack now and as a standard feature in version 2.0

I know that to. instant messages is different. it allows you to click there status icon (Online or Offline) and a window pops up and you can send a message to them. When they visit the boards and have an unread instant message a popup box appears with the message. Read through this post for a demo

Originally posted by philliplewis

But it does not show if they are online in the message board where the person made the message?
It does