How to check for a users custom groups?


(Steven Slade) #1

In Discourse/Admin/Groups there are automatic groups and custom groups. I am trying to identify users based off of their custom groups. In the same way you can do Discourse.User.current(), I am hoping there is something similar for querying the custom groups they have been added to.


Sorry for necroposting, but I need this and I haven’t found anything related to it.

(Rafael dos Santos Silva) #3
Discourse.User.current().groups.forEach((g) => { console.log(; });

TypeError: Discourse.User.current(...).groups is undefined
Discourse.User.current().groups.forEach((g) => { console.log(; });

I get this error when I try to get it :confused:

(Rafael dos Santos Silva) #5

The groups field gets filled in some pages, like on your profile.

How to add external link on top menu?

I see… Would it be possible to get this info externally like grabbing the current/session.json?

(Rafael dos Santos Silva) #7

In a plugin? For sure!