ENXF NET
Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
- Joined
- Nov 13, 2018
- Messages
- 34,216
- Points
- 823
Reputation:
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?
PHP:
Is there a simpler way to achieve this? Writing the post directly to the entity...
Read more
Continue reading...
PHP:
Code:
/** @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...
Read more
Continue reading...