Profile should only be refetched if a different visibility level is requested.
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
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;