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

Nudaii

Well-known member
howdy

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:)

Edit
Also whats variable to show that choice/selection as {$varible}.png?
 
Last edited:
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
http://xenforo.com/community/threads/custom-field-value-in-message-body.46937/
, i wanted to spruce it up abit.
 
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.
 
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
 
Back
Top Bottom