You are here

function zoomapi_user_find_by_email in Zoom API 7

Find Zoom user by email.

The Zoom API does offer an endpoint to search by email, however login_type must be known. This function attempts to work around that by getting a list of all users and searching for the email address.

Parameters

string $email: The email address to search for.

int $page_size: The total number of records to retrieve.

Return value

array The Zoom user information.

1 call to zoomapi_user_find_by_email()
zoomapi_user_get in ./zoomapi.module
Get Zoom User.

File

./zoomapi.module, line 154
Main file for the Zoom API module.

Code

function zoomapi_user_find_by_email($email, $page_size = 100) {
  $zoomapi_user = new ZoomAPIUser();
  $list['page_number'] = 0;
  do {
    $list = $zoomapi_user
      ->list($page_size, $list['page_number'] + 1);
    if (empty($list['users'])) {
      break;
    }
    foreach ($list['users'] as $delta => $zoom_user) {
      if ($zoom_user['email'] == $email) {
        return $zoom_user;
      }
    }
  } while ($list['page_number'] < $list['page_count']);
  return [];
}