$fullname = $USER->username; } $mediabirdDb = new MediabirdDboMoodle(); $helper = new MediabirdHtmlHelper(); unset($action); if (isset($_POST["data"]) && isset($_POST["data"]["action"])) { $action = $_POST["data"]["action"]; } else { if (isset($_GET["action"])) { $action = $_GET["action"]; } } if ($account_link = get_record("studynotes_account_links", "system", "moodle", "external_id", $moodleid)) { $mbuser = $account_link->internal_id; if (!isset($action)) { $helper->updateUser($mbuser, $fullname, 1, $email); } } else { if ($mbuser = $helper->registerUser($fullname, 1, $email)) { $account_link = (object) null; $account_link->external_id = $moodleid; $account_link->internal_id = $mbuser; $account_link->system = "moodle"; insert_record("studynotes_account_links", $account_link, false); } else { error(get_string('error_linking', 'studynotes')); } } $auth = new MediabirdMoodleAuth($mbuser); //set up config MediabirdConfig::$latex_path = $CFG->studynotes_latex_path;
unset($portal_user_item); unset($current_user_item); $mbuser = $external_id_manager->getExternalId($system,$commsy_user_id); if ( !empty($mbuser) ) { //load last login info before it will be updated if($userRecord = $mediabirdDb->getRecord(MediabirdConfig::tableName('User',true),"id=$mbuser")) { //get last login time $lastLogin = $mediabirdDb->timestamp($userRecord->last_login); //save login time $_SESSION['mb_session_time'] = $lastLogin; } $helper->updateUser($mbuser,$fullname,1,null, $pic_url, $mediabirdDb); } else { $mbuser = $helper->registerUser($fullname,1,null, $pic_url, $mediabirdDb); if ( !empty($mbuser) ) { $external_id_manager->addIDsToDB($system,$mbuser,$commsy_user_id); } else { include_once('functions/error_functions.php'); trigger_error('can not initiate mediabird account',E_USER_ERROR); } } unset($external_id_manager); if ( !empty($language) and strtolower($language) == 'de' ) {