You are here

protected function AddTeamMembersForm::getAccountsFromEmails in Apigee Edge 8

Return an array of user UIDs given a list of emails.

Parameters

string $emails: The emails, comma separated.

Return value

array An array containing a first array of user accounts, and a second array of emails that have no account on the system.

Deprecated

in apigee_edge_teams:8.x-1.12 and is removed from apigee_edge_teams:2.x. No replacement.

See also

https://github.com/apigee/apigee-edge-drupal/pull/474

File

modules/apigee_edge_teams/src/Form/AddTeamMembersForm.php, line 159

Class

AddTeamMembersForm
Add team members form.

Namespace

Drupal\apigee_edge_teams\Form

Code

protected function getAccountsFromEmails(string $emails) : array {
  $developerEmails = [];
  $notFound = [];
  $emails = array_map('trim', explode(',', $emails));
  foreach ($emails as $email) {
    if ($account = user_load_by_mail($email)) {
      $developerEmails[$email] = $account;
    }
    else {
      $notFound[] = $email;
    }
  }
  return [
    $developerEmails,
    $notFound,
  ];
}