This repository was archived by the owner on Jun 15, 2020. It is now read-only.
This repository was archived by the owner on Jun 15, 2020. It is now read-only.
Deleted users cause 2108 errors if they are still main teachers #53
Open
Description
We had some contractors set up courses and assignments and then their accounts were deleted. This has causes Turnitin to give us 2108 errors where the email address is not valid. The plagiarism plugin uses the main teacher in some parts to talk to TII such as getting scores and updating assignments. As a quick fix, I changed the deleted users email back to what it was which has allowed scores to be pulled down.
Can you have a look at what is below and see if that will work. Best case scenario would be for it to detect a deleted user and either update with an active user. I'm not sure if there are any other parts we need to look at, such as 'username' or 'uid'.
function turnitin_get_tii_user($tii, $user) {
global $USER, $DB;
if (is_number($user)) {
//full user record needed
$user = ($user == $USER->id ? $USER : $DB->get_record('user', array('id'=>$user)));
}
//check to see if the user is deleted and swap it back to their original email
if ($user->deleted) {
$user->email = substr($user->username, 0, strrpos($user->username, '.'));
}
$tii['username'] = $user->username;
$tii['uem'] = $user->email;
$tii['ufn'] = $user->firstname;
$tii['uln'] = $user->lastname;
$tii['uid'] = $user->username;
return $tii;
}
Metadata
Metadata
Assignees
Labels
No labels