Lum
Member
Hi, I'm trying to write a Wordpress -> XenForo account bridge, so am trying to edit users programatically using the DataWriter, and am running into issues with custom user fields. How would I write to the default custom fields, aka "aim" and "yahoo"?
This code
throws this error
Thanks for your help!
This code
Code:
$sUsername = str_replace(' ', "_", $WP_User->user_login);
$dbUserModel = XenForo_Model::create('XenForo_Model_User');
$cUserInfo = $dbUserModel->getUserByName($sUsername);
$iUserID = $cUserInfo['user_id'];
if($iUserID) {
$cWriter = XenForo_DataWriter::create('XenForo_DataWriter_User');
$cWriter->setExistingData($iUserID);
$cWriter->set('aim', $WP_User->aim);
$cWriter->set('yahoo', $WP_User->yim);
$cWriter->save();
}
throws this error
Code:
An exception occurred: The field 'aim' was not recognised. in /Users/sjennings/Perforce/sjennings_mac/URPG/SotAWebsite/forum/library/XenForo/DataWriter.php on line 1321
XenForo_DataWriter->_haveErrorsPreventSave() in /Users/sjennings/Perforce/sjennings_mac/URPG/SotAWebsite/forum/library/XenForo/DataWriter.php at line 1363
XenForo_DataWriter->save() in /Users/sjennings/Perforce/sjennings_mac/URPG/SotAWebsite/wp-content/mu-plugins/xenforo.php at line 126