Marcus
Well-known member
I found this to be the nicest way to create a new post (not from visitor, but from a user). How can I set $user here, as the class is protected?
Is there a simpler way to achieve this? Writing the post directly to the entity along with thread_id miss stuff like position functions etc.
PHP:
/** @var \XF\Service\Thread\Replier $replier */
$replier = \XF::app()->service('XF:Thread\Replier', $thread);
$replier->setIsAutomated();
$replier->setUser($user); // protected class so it does not work
$replier->setMessage($message);
$post = $replier->save();
Is there a simpler way to achieve this? Writing the post directly to the entity along with thread_id miss stuff like position functions etc.