XF 1.2 Custom fields = Vaule of a dropdown or radio button


Well-known member

how do i put the variable for a drop down custom field

if field is x show 1, if field is y show 2 etc?

thanks in advance:)

Also whats variable to show that choice/selection as {$varible}.png?
Last edited:


Well-known member
howdy what i mean is in the template itself:)

what i want is to create the ability for user's to have a default font colour (so all their posts use it by default)

So member "bob" in preferances sets Green as his colour via the dropdown, all his posts will therefore be green by default (unless he recolors parts)

i have done it before with txt field entries, but that was a rather tacky piece of code
, i wanted to spruce it up abit.

Lukas W.

Formerly katsulynx
I still believe, I haven't gotten what you asked for. If you set it up like above, the user will select either X or Y in his preferences (if you set the field to appear only there) and then you can call the custom field in your template with {$user.customFields.font_color} and will receive either 1 or 2 as output.


Well-known member
sadly still not working

<span style="{$user.customFields.ufc}">{xen:raw $message.messageHtml}</span> (field is ufc with display of color:{$value}) = not work

yet hardcoded as
<span style="color:blue">{xen:raw $message.messageHtml}</span> = works

for some reason its not picking up the users choice in the code.

@Mike any suggestions?


Try changing the custom field to just the name of the colour and then in the template use:
<span style="color:{$message.customFields.ufc}">{xen:raw $message.messageHtml}</span>

Note the use of $message as $user is only set for message_user_info