XF 2.1 How to access a custom field in a template?

Arno Nühm

Active member
I have a "drop down"-custom field for my users. How can I use the text of this custom field in a template?

I tried this: {$user.Profile.custom_fields.Test1} but it only shows the value, not the text.
 
Thanks for your answer! I tried. This shows the title of the custom field.

ID: Test1
Title: Test
"Drop Down"-Menu

1. aaa = Text for aaa
2. bbb = Text for bbb
3. ccc = Text for ccc

I need to show e.g. "Text for bbb" if the user chooses this.

If I use {$user.Profile.custom_fields.Test1} it would show "bbb" - not "Text for bbb". That's my problem.
 
Last edited:
This works BUT I don't know what choice the user made. It could be every option (aaa, bbb, ccc, ddd, ...) and I just want to display the text of the option the user made.
 
If multiple choices are available, then its probably easiest to work in PHP and then provide the template with the phrases.
Loop thorough {$user.Profile.custom_fields.Test1} and create phrases using user_field_choice.Test1_?
 
Back
Top Bottom