public function _completeRegistration(array $user, array $extraParams = array())
 {
     if (isset($errors)) {
         return parent::_completeRegistration($user);
     }
     $silverpop = new SilverpopIntegration_Core();
     $config = $silverpop->getConfig();
     $xf_user = array('Email' => $user['email'], '_newswire_subscription' => 'Yes', 'xf_user_id' => $user['user_id'], 'xf_username' => $user['username']);
     $silverpop->addContact($config['DatabaseID'], $xf_user);
     return parent::_completeRegistration($user);
 }
 public function actionEmailPreferencesSave()
 {
     $this->_assertPostOnly();
     $visitor = XenForo_Visitor::getInstance();
     if (!$visitor->canEditProfile()) {
         return $this->responseNoPermission();
     }
     $settings = $this->_input->filter(array('silverpopintegration_subscription' => XenForo_Input::UINT));
     $writer = XenForo_DataWriter::create('XenForo_DataWriter_User');
     $writer->setExistingData(XenForo_Visitor::getUserId());
     $writer->bulkSet($settings);
     if ($dwErrors = $writer->getErrors()) {
         return $this->responseError($dwErrors);
     }
     $writer->save();
     $silverpop = new SilverpopIntegration_Core();
     $config = $silverpop->getConfig();
     $xf_user = array('Email' => $visitor['email'], '_newswire_subscription' => $settings['silverpopintegration_subscription'] ? 'Yes' : 'No', 'xf_user_id' => $visitor['user_id'], 'xf_username' => $visitor['username']);
     $silverpop->addContact($config['DatabaseID'], $xf_user);
     return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $this->getDynamicRedirect(XenForo_Link::buildPublicLink('account/email-preferences')));
 }