diff --git a/README.md b/README.md index b052b58..388fb2b 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Demo ----- Go to my wordpress demo site and register yourself, then try the links on the course page. -http://wordpress.frumbert.org/ +http://wp2moodle.coursesuite.ninja/ How to install this plugin --------------------- diff --git a/auth.php b/auth.php index 4368c40..d7b5ea5 100644 --- a/auth.php +++ b/auth.php @@ -96,12 +96,13 @@ function logoutpage_hook() { set_moodle_cookie('nobody'); require_logout(); if (isset($this->config->logoffurl)) { + if (ob_get_level() !== 0) ob_end_clean(); // in case we are inside a buffer // 301: move permanently // 302: found // 303: see other // 307: temporary redirect header("Location: " . $this->config->logoffurl, true, 301); - // redirect($this->config->logoffurl); + exit; // flush header } } diff --git a/login.php b/login.php index 5b62253..d15b43a 100644 --- a/login.php +++ b/login.php @@ -138,11 +138,11 @@ function enrol_into_course($courseid, $userid, $roleid = 5) { // mdl_user.idnumber is the wordpress wp_users.id // TODO: if (get_field('user', 'id', 'username', $username, 'deleted', 1, '')) ----> error since the user is now deleted - if ($DB->record_exists('user', array('username'=>$username, 'idnumber'=>'', 'auth'=>'manual'))) { // update manually created user that has the same username but doesn't yet have the right idnumber + if ($DB->record_exists('user', array('email'=>$email, 'idnumber'=>'', 'auth'=>'manual'))) { // update manually created user that has the same email but doesn't yet have the right idnumber $updateuser = get_complete_user_data('username', $username); $updateuser->idnumber = $idnumber; if ($updatefields) { - $updateuser->email = $email; + $updateuser->username = $username; $updateuser->firstname = $firstname; $updateuser->lastname = $lastname; }