What's new
Xen Factory

Register today to become a member! Once signed in, you'll be able to start purchasing our products, ask questions, request support and suggest new ideas!

  • This area is dedicated to the support of our xF1 add-ons. For xF2, please use the dedicated area: HERE.

Bug Fixed ErrorException: Undefined variable: user

SeToY

Member
Hello,

a user has saved their details:

Code:
Server Error Log
Error Info
ErrorException: Undefined variable: user - library\XFA\MembersMap\Extends\XenForo\ControllerPublic\Account.php:59
Generated By: peter imhof, Yesterday at 22:56
Stack Trace
#0 D:\inetpub\wwwroot\domain.com\library\XFA\MembersMap\Extends\XenForo\ControllerPublic\Account.php(59): XenForo_Application::handlePhpError(8, 'Undefined varia...', 'D:\\inetpub\\wwwr...', 59, Array)
#1 D:\inetpub\wwwroot\domain.com\library\SV\UserEss\XenForo\ControllerPublic\Account.php(54): XFA_MembersMap_Extends_XenForo_ControllerPublic_Account->actionPersonalDetailsSave()
#2 D:\inetpub\wwwroot\domain.com\library\XenForo\FrontController.php(351): SV_UserEss_XenForo_ControllerPublic_Account->actionPersonalDetailsSave()
#3 D:\inetpub\wwwroot\domain.com\library\XenForo\FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#4 D:\inetpub\wwwroot\domain.com\index.php(13): XenForo_FrontController->run()
#5 {main}
Request State
array(3) {
  ["url"] => string(66) "https://domain.com/account/personal-details-save"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(12) {
    ["status"] => string(0) ""
    ["gender"] => string(0) ""
    ["location"] => string(0) ""
    ["occupation"] => string(0) ""
    ["homepage"] => string(0) ""
    ["about_html"] => string(11) "<p><br></p>"
    ["_xfRelativeResolver"] => string(61) "https://domain.com/account/personal-details"
    ["_xfToken"] => string(8) "********"
    ["save"] => string(21) "Änderungen speichern"
    ["_xfRequestUri"] => string(25) "/account/personal-details"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}

Code:
Server Error Log
Error Info
ErrorException: Undefined property: XenForo_ControllerResponse_View::$redirectType - library\XFA\MembersMap\Extends\XenForo\ControllerPublic\Account.php:54
Generated By: peter imhof, Yesterday at 22:56
Stack Trace
#0 D:\inetpub\wwwroot\domain.com\library\XFA\MembersMap\Extends\XenForo\ControllerPublic\Account.php(54): XenForo_Application::handlePhpError(8, 'Undefined prope...', 'D:\\inetpub\\wwwr...', 54, Array)
#1 D:\inetpub\wwwroot\domain.com\library\SV\UserEss\XenForo\ControllerPublic\Account.php(54): XFA_MembersMap_Extends_XenForo_ControllerPublic_Account->actionPersonalDetailsSave()
#2 D:\inetpub\wwwroot\domain.com\library\XenForo\FrontController.php(351): SV_UserEss_XenForo_ControllerPublic_Account->actionPersonalDetailsSave()
#3 D:\inetpub\wwwroot\domain.com\library\XenForo\FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#4 D:\inetpub\wwwroot\domain.com\index.php(13): XenForo_FrontController->run()
#5 {main}
Request State
array(3) {
  ["url"] => string(66) "https://domain.com/account/personal-details-save"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(12) {
    ["status"] => string(0) ""
    ["gender"] => string(0) ""
    ["location"] => string(0) ""
    ["occupation"] => string(0) ""
    ["homepage"] => string(0) ""
    ["about_html"] => string(11) "<p><br></p>"
    ["_xfRelativeResolver"] => string(61) "https://domain.com/account/personal-details"
    ["_xfToken"] => string(8) "********"
    ["save"] => string(21) "Änderungen speichern"
    ["_xfRequestUri"] => string(25) "/account/personal-details"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}
 
Try this

In library/XFA/MembersMap/Extends/XenForo/ControllerPublic/Account.php

Find

PHP:
if ($response->redirectType == XenForo_ControllerResponse_Redirect::SUCCESS && $user = XenForo_Application::get(XFA_MembersMap_Extends_XenForo_DataWriter_User::XFA_MAP_USER_DATA));
{
    /* Time to write data with existing data retrieved from registry and our values */
    $dw = XenForo_DataWriter::create('XenForo_DataWriter_User');
    $dw->setExtraData('isAdmin', 'false');
    $dw->setExistingData($user);
    $dw->save();
}

Replace by

PHP:
if ($response instanceof XenForo_ControllerResponse_Redirect && $response->redirectType == XenForo_ControllerResponse_Redirect::SUCCESS && $user = XenForo_Application::get(XFA_MembersMap_Extends_XenForo_DataWriter_User::XFA_MAP_USER_DATA))
{
    /* Time to write data with existing data retrieved from registry and our values */
    $dw = XenForo_DataWriter::create('XenForo_DataWriter_User');
    $dw->setExtraData('isAdmin', 'false');
    $dw->setExistingData($user);
    $dw->save();
}
 
Last edited:
Top