MDL-8096 - fixed set_user_preference() weirdness, you could not pass $USER->id as $otheruser parameter

This commit is contained in:
skodak 2007-01-25 18:17:57 +00:00
parent d873478322
commit 29c7e08328

View File

@ -736,7 +736,7 @@ function set_user_preference($name, $value, $otheruser=NULL) {
if ($preference = get_record('user_preferences', 'userid', $userid, 'name', $name)) {
if (set_field('user_preferences', 'value', $value, 'id', $preference->id)) {
if (empty($otheruser) and !empty($USER)) {
if ($userid == $USER->id) {
$USER->preference[$name] = $value;
}
return true;
@ -749,7 +749,7 @@ function set_user_preference($name, $value, $otheruser=NULL) {
$preference->name = $name;
$preference->value = (string)$value;
if (insert_record('user_preferences', $preference)) {
if (empty($otheruser) and !empty($USER)) {
if ($userid == $USER->id) {
$USER->preference[$name] = $value;
}
return true;