• REGISTRATION REQUIREMENTS:

    Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Custom User Field: Change value into picture

it_

New Member
Showcase
Hello, I want to create a custom user drop down field with different options and want those automatically change into pictures.

Under general settings I tried Conditional Statemens for the html output.
For instance:

<xen:if is="{$choice} == x">
<img src="...">
<xen:elseif is="{$choice} == y" />

<img src="...">
<xen:elseif is="{$choice} == z" />

<img src="...">
<xen:else />

<img src="...">
</xen:if>


But then it always shows all the pictures.

Help is highly appreciated.
Best regards!
 
Dear @Bob B
I updatet to 2.1.1. but it still shows each picture like it would just ignore the <xen> commands.
I think actually it is ignoring the <xen> commands. For example if I want to output:
Code:
<xen:avatar user="$user" size="m" />
It does show nothing. Are <xen> commands even supported or what am I doing wrong?
 
Last edited:
You are going to have to be much more specific. What you want to do probably can't be handled via the output. Its not meant for doing stuff like that.
 
Thank you I managed to work this out, my thoughts were to complicated before. I simply had to use this code:
Code:
<img src="url/{$choice}.png">
Now it displays an image instead of the chosen value.

Nevertheless I would like to know is it somehow possible to display the creators name of an item through Value Display HTML?
 
Unfortunately it does not work. May there is any other method? If not I may request this for a future addon.
 
Last edited:
What exactly are you trying to do? That HTML output is not designed for anything fancy. Its simply to change the basic output of the field itself.
 
Ya, stuff like that is not what that is designed for. You really should use self place fields and do the customization in the template with xen syntax (where you can even use callbacks if needed).
 
Back
Top