You are here

function uif_import_user in User Import Framework 7

Same name and namespace in other branches
  1. 6 uif.admin.inc \uif_import_user()

Import one user.

1 call to uif_import_user()
uif_batch_import_users_process in ./uif.admin.inc
User import batch processing.

File

./uif.admin.inc, line 485
Simple, extensible user import from a CSV file.

Code

function uif_import_user($user_data, $notify, &$results, $form_state) {
  $args = array(
    ':mail' => db_like($user_data['mail']),
  );
  if ($uid = db_query('SELECT uid FROM {users} WHERE mail LIKE :mail', $args)
    ->fetchField()) {
    global $user;
    if ($uid === $user->uid) {
      $results['self'] = $user_data;
      return;
    }
    $account = uif_update_user($user_data, $uid, $form_state);
    $results['updated']++;
  }
  else {
    $account = uif_create_user($user_data, $notify, $form_state);
    $results['created']++;
  }
}