MDL-58486 userprefs: clarifying comment

This commit is contained in:
Dan Poltawski 2017-04-17 12:17:18 +01:00
parent 48411a8843
commit 4ba4ecfa96

View File

@ -1932,6 +1932,7 @@ function set_user_preference($name, $value, $user = null) {
// Update value in cache.
$user->preference[$name] = $value;
// Update the $USER in case where we've not a direct reference to $USER.
if ($user !== $USER && $user->id == $USER->id) {
$USER->preference[$name] = $value;
}
@ -2004,6 +2005,7 @@ function unset_user_preference($name, $user = null) {
// Delete the preference from cache.
unset($user->preference[$name]);
// Update the $USER in case where we've not a direct reference to $USER.
if ($user !== $USER && $user->id == $USER->id) {
unset($USER->preference[$name]);
}