mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-80793 calendar: Setup $USER with all fields
This commit is contained in:
parent
f30110b5eb
commit
944be2dd21
@ -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');
|
||||
|
Loading…
x
Reference in New Issue
Block a user