You are here

function user_user_import_pre_save in User Import 5.2

Same name and namespace in other branches
  1. 8 supported/user.inc \user_user_import_pre_save()
  2. 5 supported/user.inc \user_user_import_pre_save()
  3. 6.4 supported/user.inc \user_user_import_pre_save()
  4. 6.2 supported/user.inc \user_user_import_pre_save()
  5. 7.3 supported/user.inc \user_user_import_pre_save()
  6. 7 supported/user.inc \user_user_import_pre_save()
  7. 7.2 supported/user.inc \user_user_import_pre_save()

Implementation of hook_user_import_pre_save().

File

supported/user.inc, line 50

Code

function user_user_import_pre_save($settings, $account, $password, $fields, $errors) {
  $account_add['mail'] = $fields['user']['email'][0];
  if (empty($settings['options']['update_users'])) {
    $account_add['timezone'] = '-18000';
    $account_add['status'] = 1;
    $account_add['init'] = $fields['user']['email'][0];
    $account_add['pass'] = empty($fields['user']['password'][0]) ? user_password() : $fields['user']['password'][0];

    // get enabled roles
    while (list($rid, $role_set) = each($settings['roles'])) {
      if (!empty($role_set)) {
        $account_add['roles'][$rid] = $rid;
      }
    }
    if (!empty($settings['options']['activate'])) {
      $account_add['access'] = time();
      $account_add['login'] = time();
    }
    if ($settings['contact'] == 1) {
      $account_add['contact'] = 1;
    }
  }
  return $account_add;
}