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?
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.
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.