XF 2.0 Passing a $user variable to the thread_view template

AndyB

Well-known member
In the thread_view template, is there a direct way for me to use the following variable:

{$user.trader_seller_count}

I have added the field trader_seller_count to the xf_user table and extended the entity.

Thank you.
 
{$thread.User} should do it (though you may want to check that actually returns something, in case it's a guest created thread or a deleted user.
 
Works perfect. I tried {$thread.user.trader_seller_count} but forgot about the case. The variable User must be uppercase U.

Thank you, Chris.
 
In a template what is the proper syntax to add these two variables?

{$thread.User.trader_seller_count} + {$thread.User.trader_buyer_count}
 
You probably want this so it formats it as a number (including the thousands separator if necessary)
Code:
{{ ($thread.User.trader_seller_count + $thread.User.trader_buyer_count)|number }}
 
Top Bottom