From c9afdae01ccf48d1456be3f98b257d6f18097882 Mon Sep 17 00:00:00 2001 From: Martin Lyth Date: Sat, 2 Jul 2016 17:02:37 -0400 Subject: [PATCH] Check if we're the current user before retrieving --- classes/Profile.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/classes/Profile.php b/classes/Profile.php index ef3f5c1b2f..b557e3088c 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -89,13 +89,14 @@ class Profile extends Managed_DataObject public function getUser() { if (!isset($this->_user[$this->id])) { - $user = User::getKV('id', $this->id); - if (!$user instanceof User) { - throw new NoSuchUserException(array('id'=>$this->id)); - } $cur_user = common_current_user(); if (($cur_user instanceof User) && $cur_user->sameAS($this)) { $user = $cur_user; + } else { + $user = User::getKV('id', $this->id); + if (!$user instanceof User) { + throw new NoSuchUserException(array('id'=>$this->id)); + } } $this->_user[$this->id] = $user; } -- 2.39.5