AndyB Well-known member Oct 13, 2017 #1 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.
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.
AndyB Well-known member Oct 13, 2017 #3 Chris D said: Who is $user? The thread author? Click to expand... Correct.
Chris D XenForo developer Staff member Oct 13, 2017 #4 {$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.
{$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.
AndyB Well-known member Oct 13, 2017 #5 Works perfect. I tried {$thread.user.trader_seller_count} but forgot about the case. The variable User must be uppercase U. Thank you, Chris.
Works perfect. I tried {$thread.user.trader_seller_count} but forgot about the case. The variable User must be uppercase U. Thank you, Chris.
AndyB Well-known member Oct 13, 2017 #6 In a template what is the proper syntax to add these two variables? {$thread.User.trader_seller_count} + {$thread.User.trader_buyer_count}
In a template what is the proper syntax to add these two variables? {$thread.User.trader_seller_count} + {$thread.User.trader_buyer_count}
Chris D XenForo developer Staff member Oct 13, 2017 #7 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 }}
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 }}