XF 2.2 Is there a similar variable

MesterPerfect

Active member
In XenForo there is a variable to fetch all user posts
$user.message_count|number
But why isn't there a variable to fetch all user threads
$user.thread_count|number
 
Depending on where you want to fetch this info, you should be able to use:
$this->repository('XF:Thread')->findThreadsStartedByUser($user.user_id)->total();
If you plan to use it a lot then you'll have to cache it, otherwise above mentioned add-on looks good.
I was planning to use it like this

Code:
<xf:if is="$extras.thread_count">
<dl class="pairs pairs--justified">
<dt>{{ phrase('threads') }}</dt>
<dd>{$user.thread_count|number}</dd>
</dl>
</xf:if>
 
The question is where and how often.
Seems like you want to fetch the info often so you'll either have to write your own code to keep track of the count or use Lawrence's add-on as Ozzy47 suggested.
 
Back
Top Bottom