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.
Need help : ConversationMessageModel->save()
Clément
✭
I would like to add a new private message to new members.
I'm more or less happened.
I think we should first create a conversation ?
Can you give me an example please ?
This example works but if I comment "ConversationID", it doesn't works.
$conversationMessageModel = new ConversationMessageModel(); $conversationMessageModel->save(array( 'To' => 'Clément', 'Format' => 'Wysiwyg', 'Body' => 'xxxTest', '_wysihtml5_mode' => 1, 'Start_Conversation' => 'Commencer la conversation', 'RecipientUserID' => array(2), 'DateInserted' => '2015-10-01 06:38:21', 'InsertUserID' => 2, 'InsertIPAddress' => '127.0.0.1', 'DateUpdated' => '2015-10-01 06:38:21', 'UpdateUserID' => 2, 'UpdateIPAddress' => '127.0.0.1', 'ConversationID' => 8334, ));
Thank you in advance for your help !
0
Comments
I think you can get it solved quite quickly. You've used the conversationMessageModel. A conversation consists of several messages. So the conversationMessageModel needs an existing conversation to operate.
You would have to use the conversationModel which also has a save() method. I would assume that it takes the same input as the code you've shown above, except for the conversation ID since this method creates a new conversation which is exactly what you want.
Thank you for your reply.
I understand better now. But I don't understand the second parameter of method "save"
What should I put in the second parameter ?
I haven't think about it but i can use the API of @Kasper for it is more easy to add a new Conversation
I have written a plugin for that:
http://vanillaforums.org/addon/registrationmessage-plugin
My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations
VanillaSkins.com - Plugins, Themes and Graphics for Vanillaforums OS
Houps ... I'm really sorry, I searched with "PM", "Private Message", "Conversation".
I can not install it yet, there apparently was a fatal error (with php 5.6).
Perhaps because of "("
Or ";" ?
I think that this module will not work with the inscription via Facebook.
The EntryController_RegistrationSuccessful_Handler hook() is not active.
With this one instead: userModel_afterRegister_handler()
What I have noticed
Thanks for pointing that out, I'll update it soon.
But it should give you an idea how to use the conversationmodel. Note that notifications will only work correctly as of 2.2 because of this:
https://github.com/vanilla/vanilla/pull/2793
My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations
VanillaSkins.com - Plugins, Themes and Graphics for Vanillaforums OS
Thanks for the information !
Your code is an excellent example for me !!
I integrated into my module, it works perfectly!