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

Syntax calculated threads

Discussion in 'XenForo Development Discussions' started by cobra1162, Dec 12, 2010.

  1. cobra1162

    cobra1162 Active Member

    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
     
  2. Allan

    Allan Well-Known Member

    Interessant .. ;)
     
  3. ragtek

    ragtek Guest

    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)
     
  4. cobra1162

    cobra1162 Active Member

    ok thanks
     

Share This Page