- Affected version
- 2.0.11
The ajax 'like' click will return nothing, but reloading the page says "1 person/x people"
fnLikes natively handles if
But
Where as
fnLikes natively handles if
$count
has a value but $likes
is empty.But
XF\Pub\View\Like\Like
does this check;
PHP:
if ($count && $likes)
{
$templater = $this->renderer->getTemplater();
$html = $templater->fn('likes', [$count, $likes, $isLiked, $listUrl]);
}
else
{
$html = '';
}
Where as
fnLikes
does this;
PHP:
$count = intval($count);
if ($count <= 0)
{
return '';
}
if (!$users || !is_array($users))
{
$phrase = ($count > 1 ? 'likes.x_people' : 'likes.1_person');
return $this->renderTemplate('public:like_list_row', [
'url' => $url,
'likes' => \XF::phrase($phrase, ['likes' => $this->language->numberFormat($count)])
]);
}