From: Raphaël Barrois Date: Sun, 4 Nov 2012 22:51:19 +0000 (+0100) Subject: Avoid useless profile fetches. X-Git-Tag: xorg/1.1.6~11 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=6178c3f31864ca86a7ede818d0ce0f40de341f58;p=platal.git Avoid useless profile fetches. Profile should only be refetched if a different visibility level is requested. Signed-off-by: Raphaël Barrois --- diff --git a/classes/user.php b/classes/user.php index 4626b85..d2ecc1a 100644 --- a/classes/user.php +++ b/classes/user.php @@ -363,7 +363,7 @@ class User extends PlUser if (!$this->_profile_fetched || $forceFetch) { $this->_profile_fetched = true; $this->_profile = Profile::get($this, $fields, $visibility); - } else if ($this->_profile !== null && !$this->_profile->visibility->equals($visibility)) { + } else if ($this->_profile !== null && $visibility !== null && !$this->_profile->visibility->equals($visibility)) { return Profile::get($this, $fields, $visibility); } return $this->_profile;