Is it possible to use custom profile fields in custom post rail?

Antex's Avatar
Antex · in Support
2 replies 40 views

I know that the character sheet allows them to appear in the post rail but can we call on specific fields in the HTML/CSS?

0

I know previously you could but it would call on ALL of the profile fields instead of just one or two that you selected unless @Cedric has changed this with the 2.0 update.

0

Howdy!

Yes, you can. @prophet is right that {{#each user.custom_fields}} prints every field. You don't have to use the loop, though. You can pick a single field by its number:

{{#if user.custom_fields.0}}
  <div class="rail-race">{{ user.custom_fields.0.label }}: {{ user.custom_fields.0.value }}</div>
{{/if}}
{{#if user.custom_fields.2}}
  <div class="rail-class">{{ user.custom_fields.2.value }}</div>
{{/if}}

  • Only fields with "Show in mini profile" turned on are included. They're numbered from 0 in the order they appear in ACP > Custom profile fields.

  • If a member leaves a field blank, it's skipped and the other numbers stay the same. The {{#if}} stops an empty line from showing for that member.

  • If you reorder your fields or turn "Show in mini profile" on or off for one, the numbers change. Make sure you check your template after you do either.

  • You can't pick a field by its name or handle yet. Fields are only available by number.

Because you write the HTML yourself, you can give each field its own class (like rail-race above) and style it in your CSS.

❤️ 1
Theme: FS 2.0
Create Your Community with ForumSpark

ForumSpark is a modern community platform built on custom software. It combines the familiar feel of classic forums with a fast, simple experience designed for today’s communities.