Fixed Guest content may prevent search suggestions from being displayed

Kirby

Well-known member
Affected version
2.3.6
PHP:
$iconHtml = null;
$templater = \XF::app()->templater();
if ($user)
{
    $iconHtml = $templater->func('avatar', [
        $user,
        'xxs',
        false,
        ['href' => ''],
    ]);
}

return [
    'text' => $text,
    'url' => $url,
    'iconHtml' => $iconHtml,
    'desc' => $desc,
];

This sets iconHtml to null if the content was created by a guest which later on casues an exception when rendering the Mustache template.

Suggested Fix
1) Pass a guest user entity with the correct Username
or
2) Add an additional param for the guest username and change the above code to pass that to templater function avatar
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.3.7).

Change log:
Display search suggestions properly when results contain guest content
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom