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

xen:if statement issue in custom user fields

Discussion in 'XenForo Questions and Support' started by Dave Thomas, Feb 14, 2013.

  1. Dave Thomas

    Dave Thomas Member

    I'm trying to get images to display depending on a custom user field. The code I am using to display the images is:

    <xen:if is="{$user.customFields.Team1} == 'Red'">
    <img src="icons/tinyicon/Red.png" alt="Red">
    <xen:elseif is="{$user.customFields.Team1} == 'Blue'" />
    <img src="icons/tinyicon/Blue.png" alt="Blue">
    <xen:elseif is="{$user.customFields.Team1} == 'Green'" />
    <img src="icons/tinyicon/Green.png" alt="Green">
    But no matter what the option in Team1 is set to, the images for all three options appears, when I only want it to be the one that correlates to their choice.

    I've looked over the code and it seems ok, so what am I doing wrong?

    EDIT: I should note that I did read the FAQ, but it didn't help. Also, this is probably more suited to the troubleshooting section.
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    In which template?

    When debugging these problems it can help to dump the var in question with this template code:

    {xen:helper dump, {$user.customFields.Team1}}
    Sometimes there can be confusion with the stored value. Dumping the var will confirm the value.

Share This Page