Nevermind I got it worked out but one more error
I'm getting:
The existing data required by the data writer could not be found.
Here is my controllerpublic:
PHP:
public function actionTestUpdate()
{
$visitor = XenForo_Visitor::getInstance();
// parse input parameters
$input = $this->getInput();
$testuserid_input = $input->filterSingle('auth_id', XenForo_Input::STRING);
$duplicate = $this->_getAccountModel()->verifyUserID($testuserid_input);
if (empty($duplicate))
{
$dwAccount = XenForo_DataWriter::create('Test_DataWriter_Account');
$dwAccount->setExistingData($testuserid_input);
$index = array(
'user_id' => $visitor['user_id'],
'auth_id' => $testuserid_input
);
$dwAccount->bulkSet($index);
$dwAccount->save();
return $this->responseRedirect(
XenForo_ControllerResponse_Redirect::SUCCESS,
XenForo_Link::buildPublicLink('account/Test')
);
}
else
{
return $this->responseError("That UserID is currently in use! Please try another!");
}
}
and here is my datawriter:
PHP:
<?php
class Test_DataWriter_Account extends XenForo_DataWriter
{
/**
* Gets the fields that are defined for the table. See parent for explanation.
*
* @return array
*/
protected function _getFields()
{
return array(
'xf_test' => array(
'user_id' => array(
'type' => self::TYPE_UINT
),
'auth_id' => array(
'type' => self::TYPE_STRING, 'required' => true
),
)
);
}
/**
* Gets the actual existing data out of data that was passed in. See parent for explanation.
*
* @param mixed
*
* @see XenForo_DataWriter::_getExistingData()
*
* @return array|false
*/
protected function _getExistingData($data)
{
if (!$id = $this->_getExistingPrimaryKey($data, 'auth_id'))
{
return false;
}
return array('xf_test' => $this->_getAccountModel()->getTestUserID($id));
}
/**
* Gets SQL condition to update the existing record.
*
* @see XenForo_DataWriter::_getUpdateCondition()
*
* @return string
*/
protected function _getUpdateCondition($tableName)
{
return 'user_id = ' . $this->_db->quote($this->getExisting('user_id'));
}
/**
* Get the simple text model.
*
* @return SimpleText_Model_SimpleText
*/
protected function _getAccountModel()
{
return $this->getModelFromCache('Test_Model_Account');
}
}
?>
I've looked everywhere but nobody has seemed to have this issue and I dunno what's causing it D: