From 2333035fc239c47e3a15bb6f3d0b1ec1be95999d Mon Sep 17 00:00:00 2001 From: Joel Dapiawen Date: Thu, 4 Jul 2024 15:08:46 -0600 Subject: [PATCH] update Zoom url link and code cleaning --- lib.php | 9 ++------- locallib.php | 4 ++-- mod_form.php | 10 +++++----- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/lib.php b/lib.php index b52f013b..6512e825 100755 --- a/lib.php +++ b/lib.php @@ -100,12 +100,10 @@ function zoom_add_instance(stdClass $zoom, mod_zoom_mod_form $mform = null) { */ if(isset($zoom->assign)){ $newhost = zoom_webservice()->get_user($zoom->assign); - print_r($newhost->id); + if (!$newhost) { $zoomuser = zoom_get_user_zoomemail($USER); - // error_log($zoomuser); - // error_log(print_r($zoomuser), 1); $newhost = zoom_webservice()->get_user($zoomuser->id); } @@ -219,10 +217,7 @@ function zoom_update_instance(stdClass $zoom, mod_zoom_mod_form $mform = null) { if(isset($zoom->assign)){ $newhost = zoom_webservice()->get_user($zoom->assign); if (!$newhost) { - $zoomuser = zoom_get_user_zoomemail($USER); - // error_log($zoomuser); - // error_log(print_r($zoomuser), 1); - + $zoomuser = zoom_get_user_zoomemail($USER); } //check if hostid matches selected host if($zoom->host_id != $newhost->id){ diff --git a/locallib.php b/locallib.php index bbb23dd4..7f5a45ee 100755 --- a/locallib.php +++ b/locallib.php @@ -433,12 +433,12 @@ function zoom_get_user_zoomemail($user) { } else { $zoom_email = strtolower($user->email); - // error_log(print_r($zoom_email)); + } //try user with first.last@ZOOM_USER_DOMAIN $zoomuser = zoom_webservice()->get_user($zoom_email); - //print_r($zoomuser); + if ($zoomuser === false) { //try titlcase $zoom_email = ucfirst($user->firstname).'.'.ucfirst($user->lastname).'@'.ZOOM_USER_DOMAIN; diff --git a/mod_form.php b/mod_form.php index c68a7615..d27f15e9 100644 --- a/mod_form.php +++ b/mod_form.php @@ -97,7 +97,7 @@ public function definition() { if ($zoomuserid !== false) { // Get the array of users they can schedule. $canschedule = zoom_webservice()->get_schedule_for_users($zoomuserid); - error_log(print_r($canschedule, 1)); + // error_log(print_r($canschedule, 1)); } @@ -263,7 +263,7 @@ public function definition() { } } else { // Zoom user not found, display the cannot be found message - $a = 'https://zoom.us/signin#/login'; + $a = 'https://uregina-ca.zoom.us'; $message = "Unable to find your account ({$teacher->name}) on Zoom. If you are using Zoom for the first time, you must activate your Zoom account by logging into {$a}. Once you have activated your Zoom account, reload this page and continue setting up your meeting. Otherwise, make sure your email on Zoom matches your email on this system."; $alert_messages[] = $message; if ($teacher_email_lower == $USER->email) { @@ -1044,7 +1044,7 @@ public function data_postprocessing($data) { global $DB; parent::data_postprocessing($data); - error_log(print_r($data)); + //error_log(print_r($data)); // Get config. $config = get_config('zoom'); @@ -1072,8 +1072,8 @@ public function data_postprocessing($data) { // Get latest list of alternative hosts from the DB. $result = $DB->get_field('zoom', 'alternative_hosts', ['meeting_id' => $data->meeting_id], IGNORE_MISSING); - error_log(print_r($config->showalternativehosts)); - error_log(print_r($result)); + // error_log(print_r($config->showalternativehosts)); + // Proceed only if there is a field of alternative hosts already. if ($result !== false) { $alternativehostsdb = zoom_get_alternative_host_array_from_string($result);