public function actionNumeroUpdate ()
{
$visitor = XenForo_Visitor::getInstance();
if (!$visitor->get('user_id')) {
return $this->responseError(new XenForo_Phrase('cannot_edit_number'));
}
$userId = $this->_input->filterSingle('user_id', XenForo_Input::UINT);
$settings = $this->_input->filter(array(
'id' => array(XenForo_Input::UINT),
'numero' => array(XenForo_Input::UINT),
));
$writer = $this->_saveUser($settings, $errors);
return $this->responseRedirect(
XenForo_ControllerResponse_Redirect::SUCCESS,
XenForo_Link::buildPublicLink('user/Update'),
null);
}
protected function _saveUser($settings, &$errors)
{
$writer = XenForo_DataWriter::create('XenForo_DataWriter_User2');
$writer->setExistingData($settings['id']);
$writer->set('training_group', $settings['numero']);
$writer->preSave();
/*if ($dwErrors = $writer->getErrors())
{
$errors = (is_array($errors) ? $dwErrors + $errors : $dwErrors);
return false;
}*/
$writer->save();
return $writer;
}