1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Styling and Customization Questions' started by Nudaii, Jan 21, 2014.

  1. Nudaii

    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: Jan 21, 2014
  2. katsulynx

    katsulynx Well-Known Member

    Just like this. Or do I get you wrong here?
    Unbenannt-3.png
     
  3. Nudaii

    Nudaii 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
    http://xenforo.com/community/threads/custom-field-value-in-message-body.46937/
    , i wanted to spruce it up abit.
     
  4. katsulynx

    katsulynx Well-Known Member

    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.
     
  5. Nudaii

    Nudaii 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?
     
  6. katsulynx

    katsulynx Well-Known Member

    Probably it would help to see what is put out by the first code.
     
  7. Syndol

    Syndol Guest

    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
     
    Nudaii likes this.

Share This Page