Reply to thread

The ajax 'like' click will return nothing, but reloading the page says "1 person/x people"


fnLikes natively handles if $count has a value but $likes is empty.


But  XF\Pub\View\Like\Like does this check;

[code=php]

if ($count && $likes)

{

   $templater = $this->renderer->getTemplater();

   $html = $templater->fn('likes', [$count, $likes, $isLiked, $listUrl]);

}

else

{

   $html = '';

}

[/code]


Where as fnLikes does this;

[code=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)])

   ]);

}

[/code]


Back
Top Bottom