PaulB
Well-known member
- Affected version
- 2.1.10 Patch 2
XF\Pub\Controller\ProfilePost#assertViewableProfilePost
:
PHP:
protected function assertViewableProfilePost($profilePostId, array $extraWith = [])
{
// ...
if (!$profilePost->canView($error))
{
throw $this->exception($this->noPermission($error));
}
// ...
}
XF\Entity\ProfilePost#canView
:
PHP:
public function canView(&$error = null)
{
// ...
if (!$this->ProfileUser->canViewPostsOnProfile()) // Missing reference to $error
{
return false;
}
// ...
}
XF\Entity\User#canViewPostsOnProfile
:
PHP:
public function canViewPostsOnProfile(&$error = null)
{
return $this->canViewFullProfile() && /* ... */; // Missing reference to $error
}
XF\Entity\User#canViewFullProfile
:
PHP:
public function canViewFullProfile(&$error = null)
{
// ...
if (/* ... */)
{
$error = \XF::phraseDeferred('member_limits_viewing_profile');
return false;
}
// ...
if (/* ... */)
{
$error = \XF::phraseDeferred('this_users_profile_is_not_available');
return false;
}
// ...
}
The phrases in
canViewFullProfile
won't bubble to the controller because the reference to $error
isn't passed along.