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

Syntax calculated threads


Active member
I am looking for help to help me find the syntax for coding an addon

Let me explain

I would like to make an addon that calculates the number of discussion forums in some


forum1: number of threads
forum2: number of threads

So I would do it with the id of the forum

if anyone has a solution thank you in advance


If you don't want to code it yourself (with an nicer query) =>the Forum Model provides a method for this;)

	 * Gets the forum counters for the specified forum.
	 * @param integer $forumId
	 * @return array Keys: discussion_count, message_count
	public function getForumCounters($forumId)
So you need just to create a forumobject and to call the method with the forumid where you want to grab the info

Maybe it's also with the node model possible
	 * Gets item counts across all nodes (or all nodes in a sub-tree). This does not
	 * respect permissions.
	 * @param array|false $parentNode
	 * @return array Keys: discussions, messages
	public function getNodeTotalItemCounts(array $parentNode = null)