- Issue created by @ivnish
Automatically closed - issue fixed for 2 weeks with no activity.
/** @var \Drupal\privatemsg\PrivateMsgServiceInterface $service */
$service = \Drupal::service('privatemsg.common');
// User ids.
$members = [1, 2];
$service->createNewMessageAndThreads(1, 'test message', 'full_html', 'create message programmatically', $members);
/** @var \Drupal\privatemsg\PrivateMsgServiceInterface $service */
$service = \Drupal::service('privatemsg.common');
$message = $service->createNewMessage(1, 'test message', 'full_html');
$properties = [
'subject' => 'create message programmatically 2',
];
$service->attachMessageToExistingThreadsByProperties($properties, $message->id());
/** @var \Drupal\privatemsg\PrivateMsgServiceInterface $service */
$service = \Drupal::service('privatemsg.common');
$message = $service->createNewMessage(1, 'test message', 'full_html');
// User ids.
$members = [1, 2];
$ids = $service->createNewThreads('create message programmatically 3', $members);
$service->attachMessageToExistingThreadsByIds($ids, $message->id());
Fixed
2.0
Documentation
Automatically closed - issue fixed for 2 weeks with no activity.