How to make only a group of users can send messages to staff

The scenario is that a group of users, e.g. premium group, are allowed to send messages to staff group. Except those premium, users not in that group cannot message to staff. Is that possible to extend discourse code or write a plugin to accomplish that?

1 Like

I have a plugin that allows everyone to send to staff. It should be possible to make it so that only a group can.

It’s currently failing tests on Travis. I don’t know why.


Thanks! I will try your plugin.


@pfaffman I’m not familiar with ruby. Your method is rewriting can_send_private_message guardian, and I notice the plugin code is merged to current discourse code. Please correct me if I’m wrong.

One more question is how can I print some variables in my console, like console.log() in Javascript? I want check if the sender belongs to foo group and the receiver is bar group. I tried to put a variable but couldn’t find the result in the console. I’m developing on mac without docker container btw.

See Beginner’s Guide to Creating Discourse Plugins - Part 1

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.