Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix #347: Incorrect Reply Count in Category view

  • Loading branch information...
commit 6cfb83b7ff2d98f6b12a17eae9f685c2b467de81 1 parent 66cb726
@mahagr authored
View
9 administrator/components/com_kunena/libraries/forum/category/category.php
@@ -206,6 +206,11 @@ public function getPosts() {
return $this->_posts;
}
+ public function getReplies() {
+ $this->buildInfo();
+ return max($this->_posts - $this->_topics, 0);
+ }
+
public function getLastCategory() {
$this->buildInfo();
return KunenaForumCategoryHelper::get($this->_lastid);
@@ -695,8 +700,8 @@ protected function buildInfo() {
$categories += KunenaForumCategoryHelper::getChildren($this->id);
foreach ($categories as $category) {
$category->buildInfo();
- $this->_topics += $category->numTopics;
- $this->_posts += $category->numPosts;
+ $this->_topics += max($category->numTopics, 0);
+ $this->_posts += max($category->numPosts, 0);
if (KunenaForumCategoryHelper::get($this->_lastid)->last_post_time < $category->last_post_time)
$this->_lastid = $category->id;
}
View
4 components/com_kunena/template/blue_eagle/html/category/list_embed.php
@@ -74,7 +74,7 @@
<?php
echo $this->getCategoryIcon($childforum, true);
echo $this->getCategoryLink($childforum);
- echo '<span class="kchildcount ks">(' . $childforum->getTopics() . "/" . $childforum->getPosts() . ')</span>';
+ echo '<span class="kchildcount ks">(' . $childforum->getTopics() . "/" . $childforum->getReplies() . ')</span>';
?>
</div>
<?php endforeach; ?>
@@ -109,7 +109,7 @@
<td class="kcol-mid kcol-kcatreplies">
<!-- Number of Replies -->
- <span class="kcat-replies-number"><?php echo $this->formatLargeNumber ( $category->getPosts() ) ?></span>
+ <span class="kcat-replies-number"><?php echo $this->formatLargeNumber ( $category->getReplies() ) ?></span>
<span class="kcat-replies"><?php echo JText::_('COM_KUNENA_GEN_REPLIES');?> </span>
<!-- /Number of Replies -->
</td>
View
4 components/com_kunena/template/default20/html/category/list_category.php
@@ -53,7 +53,7 @@
</ul>
</td>
<td class="kcategory-topics"><?php echo $this->formatLargeNumber ( $this->category->getTopics() ) ?> <span><?php echo JText::_('COM_KUNENA_GEN_TOPICS') ?></span></td>
- <td class="kcategory-replies"><?php echo $this->formatLargeNumber ( $this->category->getPosts() ) ?> <span><?php echo JText::_('COM_KUNENA_GEN_REPLIES') ?></span></td>
+ <td class="kcategory-replies"><?php echo $this->formatLargeNumber ( $this->category->getReplies() ) ?> <span><?php echo JText::_('COM_KUNENA_GEN_REPLIES') ?></span></td>
<!-- td class="kcategory-subs">944 <span>Subscribers</span></td -->
<td class="kcategory-lastpost">
<ul>
@@ -75,7 +75,7 @@
<?php foreach ( $this->subcategories as $subcategory ) : ?>
<li class="kcategory-smdetails kcategory-smicon[K=CATEGORY_NEW_SUFFIX:<?php echo $subcategory->id ?>]">
<h4><?php echo $this->getCategoryLink($subcategory, null, JText::sprintf('COM_KUNENA_VIEW_CATEGORY_LIST_SUBCATEGORY_TITLE', $this->escape($subcategory->name))) ?> [K=CATEGORY_NEW_COUNT:<?php echo $subcategory->id ?>]</h4>
- <span class="kcounts"><?php echo JText::sprintf('COM_KUNENA_VIEW_CATEGORY_LIST_TOPICS_N_REPLIES', $subcategory->getTopics(), $subcategory->getPosts()) ?></span>
+ <span class="kcounts"><?php echo JText::sprintf('COM_KUNENA_VIEW_CATEGORY_LIST_TOPICS_N_REPLIES', $subcategory->getTopics(), $subcategory->getReplies()) ?></span>
</li>
<?php endforeach ?>
</ul>
View
2  components/com_kunena/template/mirage/html/category/list_category.php
@@ -36,7 +36,7 @@
</ul>
</dd>
<dd class="category-topics"><?php echo $this->formatLargeNumber ( $this->category->getTopics() ) ?> <span><?php //echo JText::_('COM_KUNENA_GEN_TOPICS') ?></span></dd>
- <dd class="category-replies"><?php echo $this->formatLargeNumber ( $this->category->getPosts() ) ?> <span><?php //echo JText::_('COM_KUNENA_GEN_REPLIES') ?></span></dd>
+ <dd class="category-replies"><?php echo $this->formatLargeNumber ( $this->category->getReplies() ) ?> <span><?php //echo JText::_('COM_KUNENA_GEN_REPLIES') ?></span></dd>
<!-- td class="kcategory-subs">944 <span>Subscribers</span></td -->
<dd class="category-lastpost">
<ul>
View
6 components/com_kunena/template/orao/html/category/list_category.php
@@ -49,7 +49,7 @@
<?php if ($this->params->get('countcolumnShow') == 0):?>
<span class="tk-activity-count">
<?php echo JText::_('COM_KUNENA_GEN_TOPICS');?>: <b><?php echo $this->formatLargeNumber ( $this->category->getTopics() ) ?></b>
- &nbsp;<?php echo JText::_('COM_KUNENA_GEN_REPLIES');?>: <b><?php echo $this->formatLargeNumber ( $this->category->getPosts() ) ?></b>
+ &nbsp;<?php echo JText::_('COM_KUNENA_GEN_REPLIES');?>: <b><?php echo $this->formatLargeNumber ( $this->category->getReplies() ) ?></b>
</span>
<?php endif; ?>
<?php if ($this->category->review && !$this->category->isSection()) : ?>
@@ -67,7 +67,7 @@
</dd>
<dd class="posts">
<span>
- <?php echo $this->formatLargeNumber ( $this->category->getPosts() ) ?>
+ <?php echo $this->formatLargeNumber ( $this->category->getReplies() ) ?>
</span>
</dd>
<?php endif;?>
@@ -100,7 +100,7 @@
<?php foreach ( $this->subcategories as $subcategory ) : ?>
<span class="tkchild-name tk-sub-categories tkchild-column-<?php echo $this->params->get('numChildcolumn')?> kcategory-smicon[K=CATEGORY_NEW_SUFFIX:<?php echo $subcategory->id ?>]">
<?php echo $this->getCategoryLink($subcategory, null, JText::sprintf('COM_KUNENA_VIEW_CATEGORY_LIST_SUBCATEGORY_TITLE', $this->escape($subcategory->name))) ?> [K=CATEGORY_NEW_COUNT:<?php echo $subcategory->id ?>]
- <?php echo '<span class="tkchild-count">( ' . $subcategory->getTopics() . " / " . $subcategory->getPosts() . ' )</span>'; ?>
+ <?php echo '<span class="tkchild-count">( ' . $subcategory->getTopics() . " / " . $subcategory->getReplies() . ' )</span>'; ?>
</span>
<?php endforeach; ?>
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.