Announcement

Collapse
No announcement yet.

How do I Count threads in Node's

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Wayne Luke
    replied
    The only place nodes are counted and displayed are in Channel Lists. There is a method in class vB_Node (/core/vb/node.php) that returns these counts. You would have to call this with your custom code. You pass a list of types you want to exclude from the count and the parentid. It would then run the query below:

    Code:
        'getContentCounts' => array(
          vB_dB_Query::QUERYTYPE_KEY => vB_dB_Query::QUERY_SELECT,
          'query_string' => "SELECT
            SUM(CASE WHEN showpublished = 1 AND showapproved = 1 AND node.parentid = {parentid} THEN 1 ELSE 0 END) AS textcount,
            SUM(CASE WHEN (showpublished = 0 OR showapproved = 0) AND node.parentid = {parentid} THEN 1 ELSE 0 END) AS textunpubcount,
            SUM(CASE WHEN showpublished = 1 AND showapproved = 1 THEN 1 ELSE 0 END) AS totalcount,
            SUM(CASE WHEN (showpublished = 0 OR showapproved = 0) THEN 1 ELSE 0 END) AS totalunpubcount
            FROM {TABLE_PREFIX}node AS node INNER JOIN {TABLE_PREFIX}closure AS cl ON cl.child = node.nodeid
            WHERE node.contenttypeid NOT IN ({excludeTypes})
            AND cl.parent = {parentid} AND node.nodeid <> {parentid}"
        ),

    Leave a comment:


  • geiri
    started a topic How do I Count threads in Node's

    How do I Count threads in Node's

    I need to count threads in a Node.

    I have a Node with 11 Sub node's and I need to count the threads in this sub nodes.

    I understand that this might be an addon's work but I am not sure if there is a feature in Vbulletin to do this or if it can be done with Modules.

    Regards
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X