XF 2.2 Saving post date time failing randomly

dethfire

Well-known member
Working on an addon that ultimately saves a post date time for a new reply to a thread and it seems to work and fail randomly. Sometimes it will save using the new post date and sometimes it saves as the current date time. I can't figure it out.

Is this correct?

PHP:
                        $replier = $this->service('XF:Thread\Replier', $thread);
                        $replier->setMessage($message);
                        if (!$replier->validate($errors))
                        {
                            return $this->error($errors);
                        }
                        $replier->getPost()->set('post_date', ($thread->post_date + 600), ['forceSet' => true]);
                        $post = $replier->save();
 
Last edited:
Top Bottom