Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
How to Let Specific Groups/Roles Use private Messages
Pavonis
New
Hello There,
So i want to let a group to only be able to message another group and no one else. I just wondered if this was possible.
0
Comments
For sure. Everything is possible with Vanilla ;-)
Part of that is quite easy, other things would require more work.
An easy plugin would check all the recipients after the author has pressed the "Send" button and return an error message. Messages cannot be send while there are errors and therefore the goal would be reached.
The ugly thing here is that a user would be able to add any user to the recipient list, writes the message and only sees the hint when he is finished with everything. It would be better if the author a) is not able to add "forbidden" role users to the list or b) if they would be added, but marked in a way that they can be distinguished from other users or c) if the error message would appear as soon as the user has been added.
Extending the plugin to have a nice UX would require Javascript knowledge that I do not really have. I would be able to give hints, though.
You would have to think about the option to add additional recipients to the conversation later on. That must be restricted, too.
I don't have much time these days, but if you would like to write such a plugin which at leasts does the basic thing and don't care for the UX, just a drop a note and I'll guide you. If you know bits of any programming language, it shouldn't be too hard. I promise.
Firstly Thanks For Your Help.
I know that you don't have time and i don't want take away your free time as well. If you could give me a link to help me get started i will figure my way through. And if i need help i will ask You .
First step should be to write a short plugin which does nothing fancy. Just a useless plugin which can be activated and deactivated. Look at the documentation for inspiration: http://docs.vanillaforums.com/developer/plugins/
Afterwards you should study some plugins how they influence Vanillas behavior. I recommend looking at plugins which interact with the MessagesController. The only plugin I could find is the Ignore plugin: github.com/vanilla/addons/blob/master/plugins/Ignore/class.ignore.plugin.php#L325-L359
After you have managed to write a plugin which prevents adding a user based on his ID to a conversation, you should get some insights on the role concept in Vanilla. Here is a plugin which shows some role handling: https://github.com/R-J/promoteAfterModerated
And after that you would have to check the role of the session user and the role of each recipient, throwing an error for each user not being in the same role.