Fixed User custom titles with falsy values don't render

Xon

Well-known member
Affected version
2.2.10 Patch 1
If you set a custom title to a falsy value (such as 0), it will fail to render.

Affected functions:
  • XF\Entity\User::setupApiResultData
    PHP:
    $result->user_title = $this->custom_title ?: $this->app()->templater()->getDefaultUserTitleForUser($this);
  • XF\Job\UserAction::applyInternalUserChange
    PHP:
    if ($customTitle = $this->getActionValue('custom_title'))
  • XF\Template\Templater::fnUserTitle
    PHP:
    $customTitle = $user->custom_title;
    if ($customTitle)
    {
       $userTitle = htmlspecialchars($customTitle);
    }
 
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.2.11).

Change log:
Fix custom user titles set to falsy values not being displayed
There may be a delay before changes are rolled out to the XenForo Community.
 
Since 2.2.12 I've suddenly found that members, often at random, are being assigned a '1' or '0' into the 'Custom title' field (previously this would have been blank). This seems likely to be related to the problem.
 
Back
Top Bottom