Allan
Well-known member
Hello, I've a problem to extend Conversation ControllerPublic.
Here is my code:
My datawriter:
This works but in the conversation menu popup it shows the conversation in double : http://prntscr.com/7gvm8n
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;
}
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: