JackBiggin
Member
I suspect this is my lack of knowledge of Xenforo rather than with the SDK (might even be a lack of PHP knowledge), but I'm trying to create a new user and set a custom field. I've done a very minor alteration to the example code. Here's my code:
However, when I try to visit the page, I'm given this error:
I'm sure that I've got to say that the array is a custom_field array, but I can't work out how to do that. Does anyone have any ideas?
Thanks.
Code:
$newUser = $sdk->addUser("$email", "$account", "$password", array('example_custom_field' => "$example"));
if(is_object($newUser)) {
// user was not created show error
echo $newUser;
} else {
// user created, $newUser holds id
echo 'New User ID: ' . $newUser;
}
However, when I try to visit the page, I'm given this error:
An exception occurred: The field 'example_custom_field' was not recognised. in /var/www/html/library/XenForo/DataWriter.php on line 1345
- XenForo_DataWriter->_haveErrorsPreventSave() in XenForo/DataWriter.php at line 1387
- XenForo_DataWriter->save() in /var/www/html/XenForoSDK.php at line 249
- XenForoSDK->addUser() in /var/www/html/xenforo_register.php at line 14
I'm sure that I've got to say that the array is a custom_field array, but I can't work out how to do that. Does anyone have any ideas?
Thanks.