Only allow certain non-admins to send private messages

AI-generated summary

SwisherSweet wants to allow only members of a specific membership plan to send private messages on their Discourse community. RGJ suggested using the min_trust_to_send_messages setting by making the members TL3 and setting the setting to 3. However, this would require locking the trust level to prevent it from being downgraded when the user reaches a higher trust level. SwisherSweet expressed concern that users would be downgraded from TL3 to TL2, and RGJ confirmed that locking the trust level is necessary. Fortunately, due to Discourse’s design, locking the trust level is available via the API.

Hi,

I am adding a Discourse community to a paid service. As one of of the paid benefits of our service, I want to be able to only allow members of a specific membership plan to be able to send private messages. From what I am finding on through searching the site is private messages can be turned off for all but admins, but I’m not seeing any way to create a permission set or group that allows me to indicate certain non-admins can send private messages, while all other non-admins cannot.

Is it possible to do what I’m looking to do and if so, it is possible to control this permission via API?

Thank you.

You might be able to use the min_trust_to_send_messages setting (make the members TL3 and set the setting to 3).

If that won’t work for you, you’ll need a plugin that overrides Guardian.can_send_private_message?. That should be doable in a few hours of work.

Thanks Richard.

If I go the trust level route, will Discourse reset the trust level for the user periodically based on the requirements:

Or, once I set the value, it is persistent until the higher trust level (eg TL4) is achieved?

My concern is that once the user moves from TL1 to TL2, they will be downgraded to TL2 from TL3.

I do see there is a Lock Trust Level option on the UI, but not certain this is available via API.

Yes, you would indeed have to lock the trust level.

Due to the way Discourse is designed, all functionality is available via the API.