Who's Online Plugin (discourse-whos-online)

(Tobias Eigen) #42

I am testing currently on my site as well. Some feedback already:

  • can you add a user pref to allow users to opt out? people welcomed this feature but also felt exposed by it. Some like to lurk without necessarily telling everyone they are online.
  • can it be made visible only to upper trust levels or by group? it’s helpful as a community management tool even if we don’t decide we want to show it to all members.

thanks! :rocket:

(Penar Musaraj) #43

One more minor feature request:

  • Toggle to enable / disable displaying plugin on the mobile site

(For now, I am using a hacky CSS display:none on mobile, but it would be more efficient to not generate it at all.)


(James Kiesel) #44

This is cool! It’s not quite the same approach as we’d take with ‘who’s online’ for Babble, but it’s a sweet plugin nonetheless :sunglasses:

(David Taylor) #45

Fixed the enabled toggle:

Added option to require login before displaying and also to restrict by trust level:

(Andrew Waugh) #46

We’ve got the plugin installed on our site and it works great - I like it.

Some of the users are complaining that they find it distracting that the list unscrolls when they mouse over it (which is kind of the point). Is there any way to allow users to configure the behaviour on a per user basis?

(David Taylor) #47

Adding per-user UI customisation isn’t something that Discourse does elsewhere, so I’m hesitant to add it to the plugin.

How about adding a delay, so they have to hold their mouse over it for an amount of time before the animation starts. That way it won’t be triggered by people just moving their mouse up to the top of the page?

So the CSS customisation would be

#whos-online a{
    transition-delay: 1s;

tweak the amount of time until you’re happy :slight_smile:

Might actually add this to the plugin if people like the idea - it does make it less distracting for users.

(Andrew Waugh) #48

I was thinking about where you would put the setting so that the user could customise it. I thought of something like a custom user field, but that would be messy.

Being me, I like to have my cake and eat it too, so modifying the global settings for the sake of the minority puts me at risk of an uprising.

How about something like the “mute” for topics etc? (i.e. mute the rollup action)
A small menu to the left of the bar with “rollup action” and the user can set “on” or “off”?

(David Taylor) #49

I get this, it’s an issue I have frequently :wink:

However in this case I’d argue it benefits everyone - the list can still be expanded easily, it’s just a bit less annoying. I will probably add this CSS to the plugin at some point anyway.

Per-user preferences isn’t something I’ll be adding, as it’s a relatively complex change. But if someone wants to make a PR I’d happily accept it.

(Rafael dos Santos Silva) #50

Hey @david,

Looks like the plugin updates by sending an array with the current online users trough message_bus, and on the js client, it filters only the new users and make a ajax request to get those users avatar_template or something else.

This will make it very likely to trigger the rate limiting, so I suggest trying to send all necessary info trough the message_bus payload.

(David Taylor) #51

Thought I’d make some quick changes to stop the repeated AJAX requests… and ended up rewriting most of the plugin :laughing:

To avoid sending the data for all online users over the messagebus every single minute I now store the “current online users” in redis, and only send things over the messagebus when something changes. Also, instead of doing an additional AJAX request on the initial page load, the plugin now sticks the necessary data in the site serializer. So hopefully much tidier and efficient.

To improve the responsiveness of the plugin I’ve hooked into the User.update_last_seen method. Right now that’s done with some somewhat dodgy method overrides, but I’ve submitted a PR to add a plugin hook in core.

This is all currently in a beta branch while I test it, but if anyone wants to help test out the changes feel free to check it out.

(David Taylor) #52

Thanks @tgxworld for merging my PR to core. The plugin’s monkey-patching now only occurs on old versions of Discourse.

These changes have been running fine on my community for a week, so I’ve now merged it into the master branch of the plugin. Please let me know if you experience any issues.

(Anton) #53

Has the problem of “zero online users” been tackled since the plugin announcement?

The idea here is as to never show “zero online users”, and always shows “at lest N users”. If there are no that much online users, simply show ones which were online most recently, but with orange color instead of green color.

So that at least N users will always be shown, some real online as by setting (circled green), and some not online, but were online most recently (if there is lack of real online users).

I’d also like to:




These all are not sophisticated nor challenging features, but together will make a sophisticated and comprehensive, very configurable plugin. Please consider implementing all of them.

(David Taylor) #54

There’s now a language string:

[quote="meglio, post:53, topic:52345"] Add a setting to customize the size of the avatar circles [/quote] [quote="meglio, post:53, topic:52345"] Add a setting to configure the placement of the "Who's online" line:[/quote] [quote="meglio, post:53, topic:52345"] online most recently (if there is lack of real online users) [/quote]

These have not been implemented. I currently have no plans to do this, but a PR would be welcome.

[quote="meglio, post:53, topic:52345"] Add a setting to configure what should open when avatar is clicked (a user profile card popup, or a user profile page, or any other ideas?)[/quote] [quote="meglio, post:53, topic:52345"] Add a setting to configure the text template of "Online (3)". [/quote] These have not changed since my response to you in December:

Avatar click:

[quote=“David_Taylor, post:21, topic:52345”]8 is controlled by Discourse (on mobile opens profile page, on desktop opens popup user card)

Text template:

Please see the top post for all of the existing settings and language strings.


Can we show how many guests are online along with this?

(David Taylor) #56

It is not currently possible, and I’m not sure that Discourse even keeps track of anonymous user sessions so it could be quite hard to implement…

(DiscourseMetrics.com) #57

If I leave the page open overnight, I often see that the number of users is really high. If I refresh the page the number goes down to the correct number.

(David Taylor) #58

Interesting… Something must be going wrong with the messagebus updates. I’ll try leaving it open on my community today and see if I can reproduce the problem.

Do you have any errors in the logs?

(Andrew Waugh) #59

It often seems a bit laggy on our site.

(David Taylor) #60

What do you mean by “a bit laggy”?

(Andrew Waugh) #61

Sometimes the display will only show 3 or 4 users at a time when the typical number would be more like 30. After a refresh the display will bounce up.

Nothing in the error logs.

I haven’t any hard data to back up the claim.

What I can say is that the display will increment when someone posts something, but then it only seems to update those users who are posting. Refreshing the page will often show a significant bump in the number of user avatars.