You are here

function zoomapi_track_user in Zoom API 7.2

Track Drupal / Zoom user account relationship.

3 calls to zoomapi_track_user()
zoomapi_api_create_user in ./zoomapi.api.inc
Create Zoom user.
zoomapi_api_get_user in ./zoomapi.api.inc
Get Zoom user.
zoomapi_api_update_user in ./zoomapi.api.inc
Update Zoom user.

File

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

Code

function zoomapi_track_user($uid, array $zoom_user) {
  $realm = zoomapi_realm();
  $record = [
    'uid' => $uid,
    'realm' => $realm,
    'zoom_user_id' => $zoom_user['id'],
    'zoom_email' => $zoom_user['email'],
  ];
  $exists = db_query("\n    SELECT\n      uid,\n      realm,\n      zoom_user_id,\n      zoom_email\n    FROM {zoomapi_users}\n    WHERE zoom_email = :email\n    AND realm = :realm\n  ", [
    ':email' => $record['zoom_email'],
    ':realm' => $realm,
  ])
    ->fetchAssoc();
  if ($exists) {
    if ($record !== $exists) {
      $record['changed'] = REQUEST_TIME;
      drupal_write_record('zoomapi_users', $record, [
        'email',
      ]);
    }
  }
  else {
    $record['created'] = REQUEST_TIME;
    $record['changed'] = REQUEST_TIME;
    drupal_write_record('zoomapi_users', $record);
  }
}