Hey, I'm working on something related to FeedsUserProcessor, basically a way to read in data and write to a user and a profiles2 profile, and ran into something I felt I should point out about this:
protected function entitySave($account) {
if ($this->config['defuse_mail']) {
$account->mail = $account->mail . '_test';
}
user_save($account, (array) $account);
if ($account->uid && $account->openid) {
Basically, that user_save() call isn't going to replace the $account in place, it instead is going to write up the new account and return it. So, to work it should be:
$account = user_save($account, (array) $account);
if ($account->uid && $account->openid) {
Comments
Comment #1
dave reidIf we are updating an existing account, the user_save() does not return anything, so $account would be set to NULL in this case, correct?
Comment #2
megachrizI added some debug code underneath the
user_save()call, imported a new user and noticed the$accountobject correctly got a user ID. This is logical, since the account object is passed by reference to theuser_save()function. So this issue is either no longer an issue or never was an issue. Anyway, could not reproduce it.Debug code: