From d7a29be3ac6862f5af5c8d0cdda6cea605f59a53 Mon Sep 17 00:00:00 2001 From: Martin Lyth Date: Thu, 30 Jun 2016 18:24:58 -0400 Subject: [PATCH] Change Profile->getUser() to match the current user Profile->getUser() gets the User independently from common_current_user. This means that changes to one does not affect the other, even if they are the same user. This changes that, so that getUser() returns common_current_user() if they are both the same user. This is done to fix a bug in the user profile settings, where changes in the language and timezone are applied to the return value of Profile->getUser() but not propagated to common_cur_user(), which causes the profile settings to display incorrect information until the page is refreshed. --- classes/Profile.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/classes/Profile.php b/classes/Profile.php index fb6a621273..a38ee9f499 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -93,6 +93,10 @@ class Profile extends Managed_DataObject if (!$user instanceof User) { throw new NoSuchUserException(array('id'=>$this->id)); } + $cur_user = common_current_user(); + if ($user->id === $cur_user->id) { + $user = $cur_user; + } $this->_user[$this->id] = $user; } return $this->_user[$this->id];