[drupal-devel] [feature] show online/offline status in theme('username')

Bèr Kessels drupal-devel at drupal.org
Thu Sep 1 11:08:51 UTC 2005

Issue status update for 
Post a follow up: 

 Project:      Drupal
 Version:      cvs
 Component:    theme system
 Category:     feature requests
 Priority:     normal
 Assigned to:  moshe weitzman
 Reported by:  moshe weitzman
 Updated by:   Bèr Kessels
 Status:       patch (code needs work)

Dries' comment ade me change my mind. I think he is very right.
y idea is that we should simpley pass more information to theme
functions and let teh themes sort out iconifying stuff. Such specific
display options must not be rendered in core, nor oin other modules,
but in themes. That is what they are for, provided they have acces to
enough information.

Bèr Kessels

Previous comments:

Sun, 21 Aug 2005 01:01:04 +0000 : moshe weitzman

Attachment: http://drupal.org/files/issues/online.patch (9.41 KB)

add css class such that a theme can put nice online/offline indicators
when showing a username link.

i made sure the relevant queries in node, user, and tracker modules
were passing the $user->access parameter which triggers the addition of
this css class.

no added quries or JOINS needed.much of this patch is just moving the
'inactivity timer' pref from the Who's Online block config page to the
main admin/settings/user page.

would be nice if someone contributed small graphics for online offline
and added these to drupal.css. this would enhance our default
presentation. i'd like for this patch not to wait on that, if possible.


Sun, 21 Aug 2005 09:10:41 +0000 : Bèr Kessels

I really like thi. +1. I managed to grey out my avatars of offline users
(looks very good!) with this patch.

One thing is the whos online block. IMO that should follow these same


Sun, 21 Aug 2005 14:01:35 +0000 : moshe weitzman

Attachment: http://drupal.org/files/issues/online_0.patch (10.22 KB)

this feature already works for the who's new and who's online blocks.

here is a slightly improved version which adds offline indicator even
for admin created users who have not yet logged in.


Sun, 21 Aug 2005 14:30:23 +0000 : Maat at drupal.hu

I patched a clean cvs install, but there are no classes in the  tags of
names of the owners of the nodes. I didn't can fix it and I have to go
I drew the icons for the default theme:
http://maat.myip.hu/~maat/maat_drupal/drupal/misc/online.png &


Sun, 21 Aug 2005 15:03:52 +0000 : Bèr Kessels

Excuse my ignorance. This pach already changed the whos online block. My
testsite had a too complex theme function, it was causing the whosonline
block to check fro the old variable still. My error. 

But my +1 still stands, though.


Sun, 21 Aug 2005 19:31:49 +0000 : moshe weitzman

thanks for the icons ... this feature already works for the who's new
and who's online blocks. perhaps someone (steven?) can add some css to
include these images. otherwise, lets just get this improved markup


Sun, 21 Aug 2005 20:29:19 +0000 : Uwe Hermann

Moshe, I think there's a left-over in your patch from another patch(?)
Look at the bluemarine stuff at the bottom.


Sun, 21 Aug 2005 20:29:53 +0000 : Uwe Hermann

Oh, and +1 for the idea (didn't try the patch, yet).


Mon, 22 Aug 2005 02:59:49 +0000 : moshe weitzman

Attachment: http://drupal.org/files/issues/online_1.patch (9.41 KB)

indeed, uwe was correct. here is a clean patch.


Mon, 22 Aug 2005 08:07:17 +0000 : Dries

Sometimes variable_get('user_seconds_online', 2700) is used, sometimes
variable_get('user_seconds_online', 900); is used.  That can't be
right, can it?


Mon, 22 Aug 2005 12:23:55 +0000 : moshe weitzman

Attachment: http://drupal.org/files/issues/online_2.patch (9.41 KB)

2700 => 900


Mon, 22 Aug 2005 12:24:11 +0000 : moshe weitzman

Attachment: http://drupal.org/files/issues/online_3.patch (9.41 KB)

2700 => 900


Mon, 22 Aug 2005 21:06:11 +0000 : Thomas Ilsche

successfully tried the patch (in a small setup)


Mon, 22 Aug 2005 21:07:05 +0000 : drumm

You can use variable_set() and variable_del() in updates.inc. I think
that would be best since you have to worry less about the cache.

The 'username' class won't be set on users who have not accessed the

I know this is a themeable function, but I'm thinking this might want
to be configurable.


Sat, 27 Aug 2005 21:27:14 +0000 : Maat at drupal.hu

Attachment: http://drupal.org/files/issues/online_4.patch (12.95 KB)

The patch works me well, but there were some bugs and/or missing

1) the comment module's sql querys were not enough to get user-status
2) the "username t(offline/online)" css classes weren't useful (unicode
classname because of the t() function; two class...) (my version is
3) there wasn't css style for usernames
4) the icons are available on http://maat.myip.hu/~maat/drupal/online


Mon, 29 Aug 2005 19:36:34 +0000 : Maat at drupal.hu

There were 4 +1-s and my, also 5 ones. The patch works without errors.
I drew iecompatible icons and white backgrounds for the bluemarine
compatibility. http://maat.myip.hu/~maat/drupal/online


Mon, 29 Aug 2005 19:37:52 +0000 : Dublin Drupaller

+1 from me..great idea



Thu, 01 Sep 2005 07:47:59 +0000 : Dries

Patch no longer applies.

What does it 'mean' to be online or offline on a Drupal site?  I think
icons are handy, but not for online/offline purposes -- Drupal sites
aren't usually /real-time communities/ like IRC or IM are.  What is the
value of knowing someone is online? 

Icons to denote whether someone is an administrator or not, paying
member (gold icon) or not, male or female, contributor or user, etc.
sounds a lot more useful to me.  The fact this patch paves the way to
more useful things is what makes me support it.

Take a look at http://www.gfxartist.com/ to see how icons can be used
in a really useful manner.


Thu, 01 Sep 2005 08:06:33 +0000 : Kobus

"Drupal sites aren't usually real-time communities like IRC or IM are.
What is the value of knowing someone is online? 

This is very handy when using a Drupal site for a dating service, or
other service where privatemsg.module is installed. It can also be used
to know if a site administrator is online, in the event of a user
experiencing trouble.

But, your point is taken, and why not implement BOTH approaches? For
online/offline, and to distinguish user roles?




Thu, 01 Sep 2005 08:11:27 +0000 : stefan nagtegaal

The more popular forums (did I hear something lately about improving and
extending our own forum???) also displays your current status.. Think
about phpBB..

I do think it's a nice addition to drupal.. :-)


Thu, 01 Sep 2005 08:13:02 +0000 : stefan nagtegaal

If more people would like to see this hot the trunk, I can update the

Please let me know..

More information about the drupal-devel mailing list