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

(Robert McIntosh) #102

A very exciting concept and I would like to try it, but before I am allowed to install it I need to answer a query.

Is it possible to exclude some groups of users? I read the section about “opting out” for individuals which I agree with, but in our case there are a large number of staff and many might log in to read, but I don’t want them to dominate the ‘who is online now’ list

Could it be possible to exclude a defined Group - or maybe (since Discourse does include better than exclude), include only certain Groups of members in the count?

(David Taylor) #103

It’s a nice idea, but not possible at the moment I’m afraid.

I’m unlikely to have time to work on this plugin any time soon, but if any other developers want to do it, #pr-welcome

(Robert McIntosh) #104

Wish I could. The last time I ‘coded’ it went something like this:

10 Let x=1
20 Print Robert
30 Let x=x+1 (that alone blew my mind)
40 If x=10 then GoTo 60
50 GoTo 20
60 End


(Jay Pfaffman) #105

If you’ve got a budget, you can post in #marketplace. It doesn’t look like it’d be extremely difficult to add a group selector and have the online checker ignore members of that/those groups.

#106

Is there a simple way to turn this off on mobile? Gets a bit crowded on smaller screens.

(David Taylor) #107

You could add a mobile-only CSS tweak - something like this should work:

#whos-online {
display: none;
}


Alternatively, you could reduce the number of avatars that are displayed by changing the whos online maximum display setting (defaults to 50). Unfortunately there isn’t any way to change this setting for mobile specifically.

#108

@david
I found a bug.

When we set the below setting at value “10”, the green flair no more shows up “on multiple users even when they are online”. I confirmed this by checking the profile of at least 4-5 such users. When I changed it back to the default value which is “5” everything started working normal again.

I’m wondering how changing this settings value from the default value of “5” to “10” can cause this kind of an issue?

If you’d like me to do any kind of troubleshooting do let me know, I’m more than happy to dig further on this.

#109

This does not work 100% for me.

#110

@ZackFea
Could you tell me if you changed the default value that was set for the below setting

Could you please check this setting and let us know what number you have entered there?

#111

Here are my settings.

(David Taylor) #112

The plugin was never intended to show online status in the list of ‘users’ for each topic. The green glow you are seeing there is part of Discourse itself, and means that the user highlighted is the “original poster and most recent poster”.

(David Taylor) #113

I’m not sure what could be causing this, I have changed the value to 10 on my own forum and can’t reproduce the problem.

It is possible that it could take up to 10 minutes for the change to take effect completely. If you’re still having problems after this then we will need to investigate further. Are you seeing any errors in your logs?

#114

I was running under that “10 minutes” setting for more than 1-2 days.
Its just that I noticed this issue today.

And within few minutes after I noticed the issue, I tried some troubleshooting like refreshing the page, enabling/disabling the plugin etc. Nothing worked.

Then I finally I reverted that setting value to the default value of “5” - it was then everything became normal. At this point, “all users that were online for the past 5 minutes were showing up as online”.

I forgot to check the logs, but I can check the logs.

#115

@david

Here are the entries from the log file

(David Taylor) #116

I don’t think any of those errors are related to whos-online. If the site is public, would you be able to temporarily change the setting to 10 and send me the URL?

Unrelated

In future you can surround logs/code with three backticks  on a line by themselves to make it more readable, like this:

sessionStorage is null Url: https://site.com/assets/application-a35601a204538cc2f69c71783bcc7324bd02636784b9fa4655ff19612832bda4.js Line: 11 Window Location: https://site.com/t/
3:27 am
3
Uncaught ReferenceError: Ember is not defined Url: https://site.com/assets/vendor-bbf794bcd87c349db7c8eebcaf45bb453e68876732b1b06bdffaea8f920f50ba.js Line: 1 Window Location: https://site.com/c/math
6:01 am
2
Uncaught ReferenceError: Ember is not defined Url: https://site.com/assets/vendor-bbf794bcd87c349db7c8eebcaf45bb453e68876732b1b06bdffaea8f920f50ba.js Line: 1 Window Location: https://site.com/t/my-p
6:01 am
Uncaught TypeError: Discourse._registerPluginCode is not a function Url: https://site.com/t//5257 Line: 47 Column: 25 Window Location: https://site.co
7:43 am
Uncaught exception: TypeError: Cannot convert 'o' to object Url: https://site.com/assets/application-a35601a204538cc2f69c71783bcc7324bd02636784b9fa4655ff19612832bda4.js Line: 5 Window Location: https
8:14 am
2
Uncaught ReferenceError: __show__deepen is not defined Url: https://site.com/t//8765 Line: 1 Window Location: https://site.com//8765
8:21 am
Uncaught TypeError: Discourse._registerPluginCode is not a function Url: https://site.com/t//8693 Line: 99 Column: 19 Window Location: https://site
9:07 am
Error: Could not find module pretty-text/censored-words imported from discourse/models/topic Url: https://site.com/assets/ember_jquery-a8dcbd325e04410f036f2a791d66d8316c48c5387acdd914de99a5dd6afb
9:51 am
Uncaught TypeError: Cannot read property '0' of undefined Url: https://site.com/assets/application-a35601a204538cc2f69c71783bcc7324bd02636784b9fa4655ff19612832bda4.js Line: 10 Column: 14475 Window Lo
11:46 am
15
(google_oauth2) Authentication failure! access_denied: OmniAuth::Strategies::OAuth2::CallbackError, access_denied
12:22 pm
NS_ERROR_FILE_CORRUPTED: Url: https://site.com/assets/vendor-bbf794bcd87c349db7c8eebcaf45bb453e68876732b1b06bdffaea8f920f50ba.js Line: 1 Column: 0 Window Location: https://site.com/t/
12:23 pm
2
TypeError: null is not an object (evaluating 'window.open(f,"_blank").focus') Url: https://site.com/assets/application-a35601a204538cc2f69c71783bcc7324bd02636784b9fa4655ff19612832bda4.js Line: 11 Col
12:59 pm
Uncaught Error: Could not find module discourse-common/lib/raw-handlebars Url: https://site.com/assets/ember_jquery-a8dcbd325e04410f036f2a791d66d8316c48c5387acdd914de99a5dd6afb3cd3.js Line: 19 Column
1:34 pm
2
Failed to compile desktop_theme stylesheet: Error: Invalid CSS after "...ng color END */": expected "}", was "" on line 76 of 19/desktop.scss >> /* categories box ch
2:30 pm
Unable to get property 'mbase' of undefined or null reference Url: https://site.com/plugins/discourse-math/mathjax/extensions/toMathML.js?V=2.7.1 Line: 19 Column: 154 Window Location: https://site.c
2:51 pm
65
(google_oauth2) Authentication failure! csrf_detected: OmniAuth::Strategies::OAuth2::CallbackError, csrf_detected | CSRF detected
3:59 pm
Uncaught Error: Could not find module discourse-common/lib/raw-handlebars Url: https://site.com/assets/ember_jquery-a8dcbd325e04410f036f2a791d66d8316c48c5387acdd914de99a5dd6afb3cd3.js Line: 19 Column
4:07 pm
Error: Could not find module pretty-text/censored-words imported from discourse/models/topic Url: https://site.com/assets/ember_jquery-a8dcbd325e04410f036f2a791d66d8316c48c5387acdd914de99a5dd6afb
4:09 pm
Uncaught exception: TypeError: Cannot convert 't' to object Url: https://site.com/assets/application-a35601a204538cc2f69c71783bcc7324bd02636784b9fa4655ff19612832bda4.js Line: 23 Window Location: http
4:15 pm
Uncaught TypeError: Cannot read property '0' of undefined Url: https://site.com/assets/application-a35601a204538cc2f69c71783bcc7324bd02636784b9fa4655ff19612832bda4.js Line: 10 Column: 14475 Window Lo
4:36 pm
140
`

#117

I’ve changed the setting to “10” and did a rebuild too.
So far things are looking good. I’ll be monitoring things.
The last time, I actually saw the issue on the second day.
So, I’m going to monitor things very closely the next 48 hours and will be reporting what I find here.

#118

I have installed the plugin on our new internal Discourse forum, but it seems like users who just keep the forum page open in a browser tab will show as active even when they lock their computer and leave for the day.

Is there a way to tweak the user activity tracking so that it only counts clicking on things, typing and scrolling the page? I think right now the email notification system will end up a bit unintuitive for new users. Since our Discourse will be behind a company firewall but users are allowed email sync on their phones, it would be great if they can trust email notifications to be sent even if they forget to close the webpage without having to turn on forced emails for everything.

I haven’t had time to test if a vanilla installation does the same thing, but I figure the plugin loads a lot of additional data to update the presence indicators and maybe some of that activity isn’t ignored?

(David Taylor) #119

The plugin uses the same logic as discourse to determine who is online. Check the “last seen” data against each user to see how it works. It doesn’t do anything that should cause users to remain online.

In theory discourse detects when the browser is not in focus, and therefore will not update “last-seen”.

You could try removing the plugin and see whether it makes a difference to the last_seen times, but I suspect it is something else that is causing the problem.

(B Iggy) #120

Hey @david,

very nice plugin I just installed today.
However not long and I got the first hater on my knee

Especially with the coming GDPR law there must be an opt-out option per user basis or I have to shut it down again

Do you maybe can check again if it’s possible?

My first hack-a-thought would be maybe a custom field where he put his/her name in. Then I check it with javascript, write it to my html as status class and say then in my CSS .avatar “display: none” ?

(David Taylor) #121

This plugin doesn’t store or display any information beyond that available in a standard discourse installation. It just presents the data in a more visible way.

There are a few posts above about adding an opt-out facility. This is definitely possible, but I don’t have the time to work on it at the moment. If anyone else fancies taking it on I’d happily accept a PR for the functionality