• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 2.0 How to get group name/css by user?

#1
Is it possible to get the user's group css and name for a template?

In the message_macros template, I want to add the following code so the user's group name will be displayed under their avatar in messages with the correct CSS as per their user group.

{$user.username_css} is intended to be the CSS (e.g. color: red;)
{$user.user_group_name} is intended to display their group name. e.g. if they were in the 'Administrator' group, it would display Administrator.
Code:
                        <dl class="pairs pairs--justified">
                            <dt>{{ phrase('group_name') }}</dt>
                            <dd style="{$user.username_css}">{$user.user_group_name}</dd>
                        </dl>
Thank you.