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

Conversation ControllerPublic

Discussion in 'XenForo Development Discussions' started by Allan, Jun 14, 2015.

  1. Allan

    Allan Well-Known Member

    Hello, I've a problem to extend Conversation ControllerPublic.

    Here is my code:
    PHP:
    public function actionInsert()
        {
           
    $response parent::actionInsert();
        
            if (
    $response->redirectType == XenForo_ControllerResponse_Redirect::SUCCESS && $conversation XenForo_Application::get(ConversationMember_DataWriter_ConversationMaster::CONVERSATION_ID))
            {
                
    $memberId $this->_input->filterSingle('member_id'XenForo_Input::UINT);
            
                
    $conversationDw XenForo_DataWriter::create('XenForo_DataWriter_ConversationMaster');
                
    $conversationDw->setExistingData($conversation['conversation_id']);
                
    $conversationDw->set('member_id'$memberId);
                
    $conversationDw->save();
            }

            return 
    $response;
        }
    My datawriter:
    PHP:
    const CONVERSATION_ID 'conversation_id';
    protected function 
    _getFields()
        {
            
    $fields parent::_getFields();
        
            
    $fields['xf_conversation_master']['member_id'] = array('type' => self::TYPE_UINT'default' => 0);
        
            return 
    $fields;
        }
        protected function 
    _postSave()
        {
           
    parent::_postSave();
            
    XenForo_Application::set(ConversationMember_DataWriter_ConversationMaster::CONVERSATION_ID$this->getMergedData());
    }
    This works but in the conversation menu popup it shows the conversation in double : http://prntscr.com/7gvm8n
     
    Last edited: Jun 14, 2015

Share This Page