HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Vanilla 3.2 - how to create link to send group message?
I want to implement button for user to start a private conversation with discussion starter and moderator.
Just to start conversation with user I use: /messages/add/authorname/subject. How I can make it to add one more user to conversation?
Next part would be to display this only if type=discussion or categoryid=2, 3, 4, I mean not to be shown in questions (I put questions in separate categories), and this button should work as something like Help function with group conversation. I edited Reply plugin to show only in discussions, not comments, but i need a little help to finish it.
Tagged:
0
Comments
You would need to create your own plugin for that that mimics the MessagesController->add() method. This is why it doesn't work with pure Vanilla:
As you can see, what is passed as "authorname" is treated as one user name.
You must create a plugin that fetches the recipient passed to the add function and transforms it to valid recipients. That would be possible with something like that:
But there is one problem: the add() method still receives the wrong user1+user2+user3 which yields an error. Not sure right now how to solve that. I'm sure there is a solution. If you can't figure it out, just drop a note and I see if I can find a way...
One could create a plugin with their own form that receives conversation message /subject (and possibly preset recipients) and then send the message internally.
Just some code snippet:
As @R_J noted, to get recipientIDs use Gdn::userModel()->getByUsername() to cycle through user names you get (or prime) on the plugin form.