function zoomapi_user_create in Zoom API 7
Create Zoom User.
Create a user account on Zoom for a given Drupal user account if the zoom user ID is not already attached to the Drupal user account.
Parameters
object $account: The Drupal user account to generate the Zoom account for.
array $options: Optional array of Zoom user configuration options.
Return value
array An array of the Zoom user account information.
File
- ./
zoomapi.module, line 244 - Main file for the Zoom API module.
Code
function zoomapi_user_create($account, array $options = []) {
$zoomapi_user = new ZoomAPIUser();
$email = !empty($options['email']) ? $options['email'] : $account->mail;
$type = !empty($options['type']) ? $options['type'] : variable_get('zoomapi_user_type_default', ZOOMAPI_USER_TYPE_DEFAULT);
// The 'track_id' on the zoom user will be used to track the Drupal user ID.
$options['track_id'] = $account->uid;
if (empty($account->data['zoomapi_user_id']) && ($zoom_user = $zoomapi_user
->create($email, $type, $options))) {
$account->data['zoomapi_user_id'] = $zoom_user['id'];
$account->data['zoomapi_user_email'] = $zoom_user['email'];
user_save($account);
return $zoom_user;
}
return [];
}