mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-41999 fix setting of USER in chat
This commit is contained in:
parent
5fed843324
commit
92911ef1b8
@ -29,10 +29,10 @@ if (!$course = $DB->get_record('course', array('id'=>$chatuser->course))) {
|
||||
}
|
||||
|
||||
//Get the user theme and enough info to be used in chat_format_message() which passes it along to
|
||||
if (!$USER = $DB->get_record('user', array('id'=>$chatuser->userid))) { // no optimisation here, it would break again in future!
|
||||
if (!$user = $DB->get_record('user', array('id'=>$chatuser->userid, 'deleted'=>0, 'suspended'=>0))) { // no optimisation here, it would break again in future!
|
||||
print_error('invaliduser');
|
||||
}
|
||||
$USER->description = '';
|
||||
\core\session\manager::set_user($user);
|
||||
|
||||
//Setup course, lang and theme
|
||||
$PAGE->set_course($course);
|
||||
|
@ -55,10 +55,10 @@ if (!$course = $DB->get_record('course', array('id'=>$chatuser->course))) {
|
||||
|
||||
//Get the user theme and enough info to be used in chat_format_message() which passes it along to
|
||||
// chat_format_message_manually() -- and only id and timezone are used.
|
||||
if (!$USER = $DB->get_record('user', array('id'=>$chatuser->userid))) { // no optimisation here, it would break again in future!
|
||||
if (!$user = $DB->get_record('user', array('id'=>$chatuser->userid, 'deleted'=>0, 'suspended'=>0))) { // no optimisation here, it would break again in future!
|
||||
print_error('invaliduser');
|
||||
}
|
||||
$USER->description = '';
|
||||
\core\session\manager::set_user($user);
|
||||
|
||||
//Setup course, lang and theme
|
||||
$PAGE->set_course($course);
|
||||
|
@ -21,14 +21,13 @@ if (!$course = $DB->get_record('course', array('id'=>$chatuser->course))) {
|
||||
}
|
||||
|
||||
//Get the user theme and enough info to be used in chat_format_message() which passes it along to
|
||||
if (!$USER = $DB->get_record('user', array('id'=>$chatuser->userid))) { // no optimisation here, it would break again in future!
|
||||
if (!$user = $DB->get_record('user', array('id'=>$chatuser->userid, 'deleted'=>0, 'suspended'=>0))) { // no optimisation here, it would break again in future!
|
||||
print_error('invaliduser');
|
||||
}
|
||||
\core\session\manager::set_user($user);
|
||||
|
||||
$PAGE->set_pagelayout('embedded');
|
||||
|
||||
$USER->description = '';
|
||||
|
||||
//Setup course, lang and theme
|
||||
$PAGE->set_course($course);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user