From 944be2dd21412220b6a4350d8f797d9b98c19b06 Mon Sep 17 00:00:00 2001 From: Harry Smith <38967972+OxyOCE@users.noreply.github.com> Date: Wed, 28 Feb 2024 10:24:56 +1300 Subject: [PATCH] MDL-80793 calendar: Setup $USER with all fields --- calendar/export_execute.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/calendar/export_execute.php b/calendar/export_execute.php index a6e81c163e1..20b5db6ac43 100644 --- a/calendar/export_execute.php +++ b/calendar/export_execute.php @@ -39,12 +39,9 @@ if (empty($CFG->enablecalendarexport)) { die('no export'); } -// Fetch basic user information to correctly log the user. -$fields = 'id,username,password,firstname,lastname'; - -$checkuserid = !empty($userid) && $user = $DB->get_record('user', array('id' => $userid), $fields); +$checkuserid = !empty($userid) && $user = \core_user::get_user($userid); // Allowing for fallback check of old url - MDL-27542. -$checkusername = !empty($username) && $user = $DB->get_record('user', array('username' => $username), $fields); +$checkusername = !empty($username) && $user = \core_user::get_user_by_username($username); if ((!$checkuserid && !$checkusername) || !$user) { //No such user die('Invalid authentication');