Thrillerek Posted August 14, 2015 Share Posted August 14, 2015 Hey. I'm kind of new to 4.0.x and currently don't have the time to search for it in the code. So I would like to ask you guys for help. How can I make this? On the previous versions it was something like this: https://www.invisionpower.com/support/guides/_/advanced-and-developers/api-methods/sending-private-messages-r223Thanks a lot! Link to comment Share on other sites More sharing options...
Thrillerek Posted August 16, 2015 Author Share Posted August 16, 2015 Refresh. Link to comment Share on other sites More sharing options...
Daniel F Posted August 16, 2015 Share Posted August 16, 2015 /* Create conversation */ $conversation = \IPS\core\Messenger\Conversation::createItem( $this->sender, $this->sender->ip_address, \IPS\DateTime::ts( time() ) ); $conversation->save(); $conversation->authorize( $recipient ); /* Add message */ $message = \IPS\core\Messenger\Message::create( $conversation, $this->content, TRUE, NULL, NULL, $this->sender ); $conversation->first_msg_id = $message->id; $conversation->save(); $notification = new \IPS\Notification( \IPS\Application::load('core'), 'private_message_added', $conversation, array( $conversation ) ); $notification->send(); Link to comment Share on other sites More sharing options...
Kevin Carwile Posted August 16, 2015 Share Posted August 16, 2015 Don't you have to do a $message->save() first before you try to assign that message id? Link to comment Share on other sites More sharing options...
Thrillerek Posted August 17, 2015 Author Share Posted August 17, 2015 Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.