You are here

public function GetServices::getUserByEmail in Simple Node Importer 8

1 call to GetServices::getUserByEmail()
GetServices::prepareEntityReferenceFieldData in src/Services/GetServices.php

File

src/Services/GetServices.php, line 416

Class

GetServices

Namespace

Drupal\simple_node_importer\Services

Code

public function getUserByEmail($email, $op = NULL) {

  // Load user object
  // $op could be 'new', 'admin', 'current', 'content_validate'.
  $userObj = user_load_by_mail($email);
  if ($userObj) {
    return $userObj;
  }
  elseif ($op == 'new') {
    return $this
      ->createNewUser($email);
  }
  elseif ($op == 'admin') {
    $adminUid = 1;
    return $adminUid;
  }
  elseif ($op == 'current') {
    $userObj = \Drupal::currentUser();
    return $userObj;
  }
  elseif ($op == 'content_validate') {
    return NULL;
  }
}