mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
MDL-8096 - fixed set_user_preference() weirdness, you could not pass $USER->id as $otheruser parameter
This commit is contained in:
parent
d873478322
commit
29c7e08328
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user