PDA

View Full Version : Show useronline on memberlist


Scott MacVicar
11-03-2001, 10:00 PM
A hack which shows if the user is online or not within a column on the memberlist. Pretty simple.

Hack suggested by Ifrani.

Last updated on 05th of November 2001 08:20 GMT

I had hoped to just add to the original SQL query to make this hack work, obviously this didn't seem possible with the errors that people have been having with sessions.

Redocumented adding an extra query.

Admin
11-04-2001, 02:19 PM
Installed here, with a little twist. :)

Scott MacVicar
11-04-2001, 02:28 PM
btw to show time instead of the little icon.

Like 12:13pm etc

Do the following

instead of using this

if($userinfo[lastactivity]>$datecut) {
eval("\$userinfo[online] = \"".gettemplate("postbit_online")."\";");
}
else {
eval("\$userinfo[online] = \"".gettemplate("postbit_offline")."\";");
}

use this

$userinfo[online] = vbdate($timeformat,$userinfo[lastactivity]);

|DarkManX|
11-04-2001, 03:13 PM
demo or SS?

thanks

eva2000
11-04-2001, 03:33 PM
Originally posted by |DarkManX|
demo or SS?

thanks

https://vborg.vbsupport.ru/memberlist.php?s= ;)

JJR512
11-04-2001, 04:11 PM
I installed this, but I noticed that for each of the two users who were online at the time I tested it, one showed up twice in the member list, and the other showed up three times. Those are duplicate entries, as seen in the attached image. The entire row was repeated right below the first row.

|DarkManX|
11-04-2001, 04:22 PM
Originally posted by eva2000


https://vborg.vbsupport.ru/memberlist.php?s= ;)



oh ok, thanks ;)

Ifrani
11-04-2001, 06:57 PM
@PPN

Thank you, it works great for me !!! Thats what I'am looking for...

Syphin
11-04-2001, 07:30 PM
Wroks great.. ^^

-Syphin

Syphin
11-04-2001, 08:04 PM
er... uuh... its showing multiple sessions for me... O.o i have the updated one installed too... O.o

:lost:

-Syphin

Ifrani
11-05-2001, 03:37 AM
Originally posted by Syphin
er... uuh... its showing multiple sessions for me... O.o i have the updated one installed too... O.o


Yep, I have the same problem...

@PPN
Can u help us, please ? :)

Scott MacVicar
11-05-2001, 06:19 AM
updated documentation, it doesn't look like i could do it with one query.

JJR512
11-05-2001, 06:28 AM
Does the updated documentation fix the problem mentioned by myself, Syphin, and Ifrani?

JJR512
11-05-2001, 06:36 AM
There is a problem with the new directions.

In the "memberlist.php" section, the stuff you say to look for in the second part of that step (starts with if ($userinfo[receivepm]) {) is actually in the file online.php file.

JJR512
11-05-2001, 06:48 AM
OK, I installed the new version. There were only a few other people online at the time. I still show up twice, but everybody else online only showed up once. I talked to another person who was online by ICQ and he confirmed that to him, I showed up twice, and everybody else online only showed up once. So there's still something not quite right here.

Syphin
11-05-2001, 07:02 AM
Originally posted by JJR512
OK, I installed the new version. There were only a few other people online at the time. I still show up twice, but everybody else online only showed up once. I talked to another person who was online by ICQ and he confirmed that to him, I showed up twice, and everybody else online only showed up once. So there's still something not quite right here.


same thing here... >_<


-Syphin

Scott MacVicar
11-05-2001, 01:54 PM
did you return the Query to,

$users=$DB_site->query("SELECT *
FROM user,userfield
WHERE $condition AND user.userid = userfield.userid
".iif($memberAllGood, " AND usergroupid NOT IN (1,3,4) ", "")."
ORDER BY $orderby $direction
LIMIT ".($limitlower-1).",$perpage");

Freddie Bingham
11-05-2001, 02:34 PM
Don't add that select query as this will achieve the same thing and will not add any queries or overhead, just add this to the code and make the html changes to the templates as described above:

find:if ($userinfo[receivepm]) {
eval("\$userinfo[pmlink] = \"".gettemplate("postbit_sendpm")."\";");
} else {
$userinfo[pmlink] = "&nbsp;";
}below it add:if($userinfo['lastactivity'] > $datecut and !$userinfo['invisible'] and $userinfo['lastvisit'] != $userinfo['lastactivity']) {
eval("\$userinfo[online] = \"".gettemplate("postbit_online")."\";");
}
else {
eval("\$userinfo[online] = \"".gettemplate("postbit_offline")."\";");
}You can apply this to any page to show whether a user is online or offline without touching the session table.

Scott MacVicar
11-05-2001, 02:36 PM
But i've noticed that sometimes the user profile doesn't update and the session query slows a different time from the one within the userprofile.

Freddie Bingham
11-05-2001, 02:38 PM
If the last* times in the user table aren't updating than there is a problem with the doshutdown() function not activating. If this was the case than you would notice that users would not be showing up on the "Browsing this forum" feature as that information is set in the same query that updates the lastvisit & lastactivity times in the user table.

Scott MacVicar
11-05-2001, 02:40 PM
ok thanks Fredie, updated the documentation and removed the query i had running and added the thing to prevent them seeing invisible users.

you also have
!userinfo['invisible']
instead of
!$userinfo['invisible']

Ifrani
11-05-2001, 04:57 PM
@PPN

Sorry I can't follow, what do I have to do ???

Scott MacVicar
11-05-2001, 05:02 PM
re apply the hack again is the simpliest way :P

Syphin
11-05-2001, 05:49 PM
Works perfect now.. ^^ thnx...

-Syphin

Admin
11-05-2001, 06:51 PM
Seems to be working ok here. Thanks freddie. :)

Ifrani
11-05-2001, 08:23 PM
Now it is doing his job :)... Thanks again...

JJR512
11-06-2001, 04:48 AM
I still see myself twice in the member list. But I'm wondering if maybe I've left something from one of the earlier versions in there that is screwing things up. Can you tell me how to make sure that all the earlier versions of this hack are completely removed?

Also, the instructions still say to do things with memberlist.php that apply to online.php, not memberlist.php.

Scott MacVicar
11-06-2001, 06:25 AM
this has nothing to do with online.php ...

its memberlist.php we're using

JJR512
11-06-2001, 06:33 AM
You say to look for
if ($userinfo[receivepm]) {
eval("\$userinfo[pmlink] = \"".gettemplate("postbit_sendpm")."\";");
} else {
$userinfo[pmlink] = "&nbsp;";
}

I don't find any of these lines in memberlist.php:

$userinfo[pmlink] = "&nbsp;";
or
eval("\$userinfo[pmlink] = \"".gettemplate("postbit_sendpm")."\";");
or
$userinfo[pmlink] = "&nbsp;";

LuBi
11-12-2001, 10:13 PM
Firefly what's the twist?

JJR512
11-12-2001, 11:12 PM
I believe his twist is that instead of putting the indicator in a separate column in the middle, he puts it next to the person name, all the way on the left (and not in a new column). I like it better Firefly's way, and that's how I did it, too.

LuBi
11-12-2001, 11:50 PM
Gotcha, no my question is I did my online offline like this site... how can I get it to show the icon and not the text next to the users name?

Barret
11-15-2001, 02:49 AM
I like the way this is done here...on this page.
How can I make this work like this page to the left with
"Online or Offline" showing under the username?
Thanks in advance.
<-----------------------------------------

Admin
11-15-2001, 10:13 AM
[QUOTE]Originally posted by LuBi
Gotcha, no my question is I did my online offline like this site... how can I get it to show the icon and not the text next to the users name?

Barret
11-15-2001, 01:23 PM
Maybe I should have been more specific....
Firefly, how did you make yours like that on the left?
Great job btw and looks really cool.
What script I need?

JJR512
11-15-2001, 02:07 PM
That's a simple matter of editing the postbit template and relocating this: $onlinestatus. Here, it's above this line: Registered: $post[joindate].

Basically... In the postbit template:
Find:
$post[avatar]<p>
<smallfont>Registered: $post[joindate]<br>
Change to:
$post[avatar]<p>
$onlinestatus<br>
<smallfont>Registered: $post[joindate]<br>

Find:
<td><smallfont>$onlinestatus
Change to:
<td><smallfont>

fiona
11-15-2001, 05:08 PM
works great for me
cheers :D

Barret
11-15-2001, 06:57 PM
Thanks man, I appreciate it!
Now if I could only make it glow online...lol

JJR512
11-15-2001, 08:02 PM
I think you need to change the postbit_online template to something like:
<smallfont><table style="filter:glow(color=#C4C400, strength=2)">Online</table></smallfont>

...and the postbit_offline template to something like
<smallfont><table>Offline</table></smallfont>

The glow style was copied from the page source here, but I'm guessing as to the exact formatting of the template. You may need to remove the <br> from after the $onlinestatus that you relocated per my earlier directions.

Barret
11-15-2001, 10:13 PM
Man that worked GREAT!!
Thank you ever so much for taking your time to help me.
I really really appreciate it!

over
11-20-2001, 09:04 PM
Originally posted by JJR512
You say to look for
if ($userinfo[receivepm]) {
eval("\$userinfo[pmlink] = \"".gettemplate("postbit_sendpm")."\";");
} else {
$userinfo[pmlink] = "&nbsp;";
}

I don't find any of these lines in memberlist.php:

$userinfo[pmlink] = "&nbsp;";
or
eval("\$userinfo[pmlink] = \"".gettemplate("postbit_sendpm")."\";");
or
$userinfo[pmlink] = "&nbsp;";

tried searching for postbit_sendpm ? instead ( ) etc sometimes causes me problems, if that happens i search for part of the txt to find.

JJR512
11-20-2001, 09:12 PM
Yeah, I know about searching for part of the text. That didn't help at the time. For some reason, all that stuff wasn't in the memberlist.php that I had at the time, but it's all been fixed now.