XF 2.0 Reference Custom Field In User Profile In Post

I am trying to reference a user's custom profile field in the post itself. What I am trying to do is let them set a color in their user control panel by adding a custom field and then referencing that in their post to allow them to set a default color.

I am currently in the post_macros template and am trying to insert:
Code:
<font color="{$xf.post.User.customFields.defaultBBcode_start.value}">
Right after

Code:
<div class="message-userContent lbContainer js-lbContainer {{ $isIgnored ? 'is-ignored' : '' }}"
                            data-lb-id="post-{$post.post_id}"
                            data-lb-caption-desc="{{ $post.User ? $post.User.username : $post.username }} &middot; {{ date_time($post.post_date) }}">
[/code]

But {$xf.post.User.customFields.defaultBBcode_start.value} doesn't seem to be the right thing I need. Is this even possible in the template I am in?
 
That seems like it almost works:

Code:
{$post.User.Profile.CustomFields.defaultBBcode_start}

Ends up putting this before the message:

Code:
XF:UserFieldValue[1, defaultBBcode_start]

I tried instead using

Code:
{$post.User.Profile.CustomFields.defaultBBcode_start}

But that throws an error message again. I want just the text in that user field, which according to https://xenforo.com/help/custom-user-fields/, should be .value at the end, but that is what throws the error. Is what I am trying to do even possible with XenForo?
 
What kind of custom field is that? Is it a text field? A select box? Multiple choice?
Your linked manual seems to be for XF1, because $visitor is now $xf.visitor AFAIK.
 
What kind of custom field is that? Is it a text field? A select box? Multiple choice?
Your linked manual seems to be for XF1, because $visitor is now $xf.visitor AFAIK.
It is a multi-line text box.

And it looks like you're right, that is the XF1 manual, my apologies. The XF2 manual doesn't seem to dive into the technical side of this sort of thing at all.
 
Blind guess:
{$post.User.Profile.CustomFields.defaultBBcode_start.0}
Should be an array. I will look into that tomorrow if that doesn't work. Feel free to remind me.
 
No luck. I tried a few variations:

Code:
{$post.User.Profile.CustomFields.defaultBBcode_start.0}
{$post.User.Profile.CustomFields.defaultBBcode_start}.(0)
{$post.User.Profile.CustomFields.defaultBBcode_start}.[0]
{$post.User.Profile.CustomFields.defaultBBcode_start.[0]}
{$post.User.Profile.CustomFields.defaultBBcode_start.{0}}
 
Back
Top Bottom