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

XF 1.2 How Do I Get Usergroup Count into a Template?

#1
Been trying to customize my Xenforo install and I'd like to show the # of users in a particular UserGroup, say USERGROUP-ZZZ, on my forum home page.

How would I go about showing this in a template? I have a template modification in the template "node_category_level_1" which is basically this:

<xen:if is="{$category.node_id} == 1">
Count: {$category.discussion_count)
<xen:include template="my_custom_template" />
</xen:if>

The modification above works great, I just can't figure out how to get the usergroup count into a variable and from the database, onto the "my_custom_template".

I know how to grab the data from phpAdmin using an SQL statement (SELECT COUNT(`user_group_id`) FROM xf_user_group WHERE `user_group_id` = 7) but I'm not entirely sure how to expose this into a template.

Any ideas? Or is this a complicated undertaking? Thank you for any help!