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

dave reid’s picture

If we are updating an existing account, the user_save() does not return anything, so $account would be set to NULL in this case, correct?

megachriz’s picture

Issue summary: View changes
Status: Active » Closed (cannot reproduce)

I added some debug code underneath the user_save() call, imported a new user and noticed the $account object correctly got a user ID. This is logical, since the account object is passed by reference to the user_save() function. So this issue is either no longer an issue or never was an issue. Anyway, could not reproduce it.

Debug code:

user_save($account, $edit);
dpm($account);
if ($account->uid && !empty($account->openid)) {