XF 2.2 Variable to output node stats of a specific node?

alternadiv

Well-known member
I tried to figure this out on my own but apparently it's not going to happen lol.

I want to add the discussion count of a specific node to a widget. I dumped the variables:

1646211858769.png

The node ID I want is 4. So based of that, I'm working with $nodeExtras, discussion_count, and 4. I tried a bunch of stuff to see if I'd get lucky and guess correctly, to no avail.

<xf:set var="$nodeExtras" value="{$xf.discussion_count.4}" />
<xf:set var="$node == '4'">{$nodeExtras.discussion_count|number}</xf:set>

No idea what I'm doing pls send help 🤯
 
I'm not sure where you're dumping exactly but the node tree and associated data isn't available in the forum statistics widget template.
 
I'm not sure where you're dumping exactly but the node tree and associated data isn't available in the forum statistics widget template.
Ah, I dumped in forum_list.

So, according to what you saw, doing what I was trying to do won't be possible solely with template edits?
 
You can use this in the forum_list template: {$nodeExtras.4.discussion_count} .
I don't think it will populate the data in the sidebar widget on forum_list.

In widget_forum_statistics:
HTML:
            <dl class="pairs pairs--justified">
                <dt>Founded</dt>
                <dd>May 1, 2018</dd>
            </dl>
           
            <dl class="pairs pairs--justified">
                <dt>Build Threads</dt>
                <dd>{$nodeExtras.4.discussion_count|number}</dd>
            </dl>
           
            <dl class="pairs pairs--justified">
                <dt>{{ phrase('threads') }}</dt>
                <dd>{$forumStatistics.threads|number}</dd>
            </dl>

But it shows this:
1646230087467.png

I was going to do the same thing with number of users in a specific user group (where it says "supporting members") and number of images in the XFMG but would those work either?
 
Related, would it be possible to have the output of a custom profile field as a navigation item?

I have a profile field "your build thread" where members put the URL to the thread. If I could call that into a navigation item, that would be good.
 
Back
Top Bottom