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

Manipulate discussion_state in new created discussions

Discussion in 'XenForo Development Discussions' started by Marcus, Jul 19, 2013.

  1. Marcus

    Marcus Well-Known Member

    In some occasions I want to manipulate the message state of new added discussions. In DataWriter_Discussion_Thread everything useful for that is protected. In ControllerPublic_Forum::actionAddThread, the discussion_state is set:
        // discussion state changes instead of first message state
    $writer->set('discussion_state'$this->getModelFromCache('XenForo_Model_Post')->getPostInsertMessageState(array(), $forum));
    This works, but how could I get access to the $writer variable again?
    class Spam_ControllerPublic_Forum extends XFCP_Spam_ControllerPublic_Forum
       public function 
    $response parent::actionAddThread();
    $threadId $writer->get['thread_id'];
    $writer XenForo_DataWriter::create('XenForo_DataWriter_Discussion_Thread');

    If its not possible to get access to $writer, how could I get access to the redirecting URL?
          $return XenForo_Link::buildPublicLink('threads'$thread);

  2. xf_phantom

    xf_phantom Well-Known Member

    you could overwrite XenForo_Model_Post::getPostInsertMessageState or the thread dw with the proxy system and change the state:)
    Marcus likes this.
  3. xf_phantom

    xf_phantom Well-Known Member

    Marcus likes this.

Share This Page