MDL-41999 fix setting of USER in chat

This commit is contained in:
Petr Škoda 2013-10-01 09:23:42 +02:00
parent 5fed843324
commit 92911ef1b8
3 changed files with 6 additions and 7 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);