XF 2.1 set post date in new replier

shqawe

Member
Greeting,

I am trying to set post date as last post date in thread table when i create replier i tried to extend replier service and set new function as below and use it when i create replier but it doesn't work :

Service\Thread\Replier

PHP:
public function setPostDate()
    {
        
            $this->post->post_date = $this->thread->last_post_date;
        
    }

Create replier code:

PHP:
\XF::asVisitor($user, function () use ($thread, $replyAcot) {
                $replier = \XF::service('XF:Thread\Replier', $thread);
                $replier->setMessage($replyAcot->acot_message);
                $replier->setPostDate();
                $replier->setIsAutomated();
                $replier->save();
            });

Any help 🙏
 
Back
Top Bottom