Posted by Fayna on June 2, 2008 at 6:11am
Jump to:
| Project: | User Stats |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
I've been looking for ways to do this---would User Stats enable me to do it? i.e., show an "Online now" image next to the username of a node author.
Comments
#1
Yes. See the documentation.
#2
Oh geez, I'm a doofus. Thanks. :-)
#3
Hehehe. No worries. :D
#4
Sorry >.<, I got it working great, but is there a way to only show the online image and no offline image?
#5
Off the top of my head, and totally untested, but try this:
<?php if (user_stats_get_stats('online', $node->uid)): ?><img src="<?php print base_path() . path_to_theme() ?>/online.png" alt="User is online" />
<?php endif; ?>
#6
Yay thank you!! It worked!
#7
Automatically closed -- issue fixed for two weeks with no activity.
#8
hi, any chance to implement this into user-profile.tpl.php? (located in modules/user)? it would be nice to have online/offline status right in user profile
Online:
<?phpprint (user_stats_get_stats('online', $node->uid) ? 'yes' : 'no');
?>
is not working of course
btw... print base_path() . path_to_theme() unfortunatelly prints out "modules/user" path to modules directory
many thanx
#9
I am confused. Under which circumstances is that supposed to work? Because basically the module seems to work perfectly (the "Is online"-filter in Views for example works). I tried to add the following to the node.tpl.php:
Online:
<?phpprint (user_stats_get_stats('online', $node->uid) ? 'yes' : 'no');
?>
But that doesn't work, all users appear as offline although I have a block at the right side that clearly shows that the module is correctly detecting online users. And to complete my confusion this piece of code works:
Post count:
<?phpprint user_stats_get_stats('post_count', $node->uid);
?>
How can I solve that?
Regards,
jakewalk
#10
Same problem here... I can't use the 'online' option. Function is called, but result is empty.
#11
How would you do this for drupal 7?