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

Syntax calculated threads

cobra1162

Active member
#1
hello,
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

example

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
 
R

ragtek

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

PHP:
/**
	 * 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
PHP:
	/**
	 * 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)