• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Extending thread leaves blank entries in Recent Activity

arms

Active member
#1
All seems to work fine. Extra fields are filled in etc. But now finding I'm getting empty recent activity entries.

upload_2014-3-21_9-8-20.png

I'm extending actionCreateThread and actionAddThread.

Could it be to do with the extra save in:

PHP:
        function actionAddThread()
        {
            $suffixId = $this->_input->filterSingle('suffix_id', XenForo_Input::UINT);
            $forumId = $this->_input->filterSingle('node_id', XenForo_Input::UINT);
           $ftpHelper = $this->getHelper('ForumThreadPost');
           $forum = $ftpHelper->assertForumValidAndViewable($forumId ? $forumId : $forumName);          
            $parent = parent::actionAddThread();
         
            $threadId = $parent->params['thread']['thread_id'];
           
            if (!$this->_getSuffixModel()->verifySuffixIsUsable($suffixId, $forumId))
            {
            $suffixId = 0; // not usable, just blank it out
            }
           
            $dw = XenForo_DataWriter::create('XenForo_DataWriter_Discussion_Thread');
            $dw->setExistingData($threadId);
            $dw->getFirstMessageDw();
            $dw->set('suffix_id', $suffixId);
            $dw->preSave();
            if ($forum['require_suffix'] && !$dw->get('suffix_id'))
        {
            $dw->error(new XenForo_Phrase('please_select_a_suffix'), 'suffix_id');
         
        } 
            $dw->save();
         
            return $parent;
        }
Any help would be appreciated.
 
Last edited:

arms

Active member
#2
Ok,

After investigating, my methods seem flawed.

It looks like what I should be doing is using _preSave and _postSave in the datawriter.

Should I also be moving this to actionValidateField
PHP:
if ($forum['require_suffix'] && !$dw->get('suffix_id'))
        {
            $dw->error(new XenForo_Phrase('please_select_a_suffix'), 'suffix_id');
      
        }