Skip to content

Commit

Permalink
Merge pull request #4 from uofr/Zoomfixupdate
Browse files Browse the repository at this point in the history
update Zoom url link and code cleaning
  • Loading branch information
JohnOLane authored Jul 4, 2024
2 parents 0628b47 + 2333035 commit 216504b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
9 changes: 2 additions & 7 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}
Expand Down Expand Up @@ -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){
Expand Down
4 changes: 2 additions & 2 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}


Expand Down Expand Up @@ -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 href=\"{$a}\" target=\"_blank\">{$a}</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) {
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 216504b

Please sign in to comment.