XF 1.5 UserFields variables

duterte

Member
What are the available variables in Custom User Field "Value Display HTML"?
I am trying to insert link to user profile, but it doesnt work:

href="/member/{$user.username}.{$user.user_id}/"
 
The available tokens are in the description of that box:

If not empty, this allows you to format the value of this field using HTML, allowing you to do things like link or mark up the output. You may use these placeholders: {$value} - the field's display value; {$valueUrl} - the field's display value for use in a URL; {$choice} - the underlying value of the chosen option; and {$fieldId} - the ID of this field (N/A).

These are straight string replacements in the code:

library/XenForo/ViewPublic/Helper/User.php

Code:
		if (!empty($field['display_template']))
		{
			if ($multiChoice && is_array($value))
			{
				foreach ($value AS $choice => &$thisValue)
				{
					$thisValue = strtr($field['display_template'], array(
						'{$fieldId}' => $field['field_id'],
						'{$value}' => $thisValue,
						'{$valueUrl}' => urlencode($thisValue),
						'{$choice}' => $choice,
					));
				}
			}
			else
			{
				$value = strtr($field['display_template'], array(
					'{$fieldId}' => $field['field_id'],
					'{$value}' => $value,
					'{$valueUrl}' => urlencode($value),
					'{$choice}' => $choice,
				));
			}
		}
 
Top Bottom