XF 1.5 Using conditionals in custom user field

NinaMcI

Active member
#1
Hi,
I'm trying to figure out how I can have different link outputs depending on the text input of a custom user field.
This is what I've tried, but withou any success.

Code:
<xen:if is="{$value}=='coursera'"><a href="https://www.coursera.org/about/">{$value}</a>
<xen:elseif is="{$value}=='OpenLearn by The Open University'"><a href="http://www.open.edu/openlearn/">{$value}</a>
<xen:else />
</xen:if>
Basically, if the text input in the custom field is "Coursera", I want the output to link to Coursera URL or if the input text in the custom field is "OpenLearn by The Open University", I want the output to link to OpenLearn URL

Any suggestions would be very much appreciated :)
 

Mike

XenForo developer
Staff member
#2
Is this in the value display HTML? That doesn't support template conditions. You can only use something along this line directly in the template. (The variables would be a bit different and context dependent.)
 

NinaMcI

Active member
#3
Is this in the value display HTML? That doesn't support template conditions. You can only use something along this line directly in the template. (The variables would be a bit different and context dependent.)
Oh right. OK, thanks.
 
Top