Can I activate my plugin only for those registered on the site?

I would like to display the number of logged users (users online plugin) on the site only for logged users (my all members from trust 0-4).
But I don’t know how to disable this plugin on the site for guest ?

Why is there no such thing as a user group or trust level (-1 ? ) for not registered - not logged in/guest users?
How can I put it in the code?

Did you try changing the “whos online display public” setting?

A list of all settings can be found here: Who's Online Plugin (discourse-whos-online)


Edit: Scratch this, see David’s post above. I didn’t realize a setting existed!

The simplest way would be to hide it using CSS, we add the anon class to the html tag when someone isn’t logged in.

.anon #whos-online {
    display: none;

Because we don’t know who they are, so we couldn’t effectively put them into a group.


Okay, thanks!

I’ll check it out right away, but I already have a question.
Why can’t I define a user group as not logged in? Other forums allow this. I mean, they give them permissions (like ipb, mybb, Vbull)

What if I want to write my own plugin that only activates for anonymous users? Is it enough for me to have a css class or something else?

oh I guess I see what you’re saying, this really isn’t a group though is it? A group has members. This would just be anyone who isn’t logged in. It’s kind of the lack of a group.

Are there other permissions you want to grant to anonymous users other than hiding whos online?

1 Like

You may need it in the plugin.

1 Like

Yeah, there’s a lot of it. I would like for example the icons from the flag component (Trust-Level Avatar Flair) to appear only when users logged in.

You can target the anon class to hide pretty much anything from anonymous users.


So do I understand that a command is enough, or do I have to add some parameters?

    const currentUser = this.currentUser;
    if (!currentUser) {
1 Like

Yes, I think that’s enough.

1 Like

Do I need to edit the plugin and rebuild the forum to make such a simple change or can I do it from the admin panel in the head or footer section. Is it possible?