From d924a462f39ff922a4cc9f6635cfe5d0c0f14db3 Mon Sep 17 00:00:00 2001 From: brettp Date: Tue, 7 Jun 2011 22:10:39 +0000 Subject: Refs #3510, #3433. Ported r9062 to trunk. Fix for comment hook returning 0 comments. git-svn-id: http://code.elgg.org/elgg/trunk@9139 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggEntity.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php index 79b8c2a4e..8fc1e46cb 100644 --- a/engine/classes/ElggEntity.php +++ b/engine/classes/ElggEntity.php @@ -850,12 +850,11 @@ abstract class ElggEntity extends ElggData implements * @since 1.8.0 */ function countComments() { - $type = $this->getType(); $params = array('entity' => $this); - $number = elgg_trigger_plugin_hook('comments:count', $type, $params, false); + $num = trigger_plugin_hook('comments:count', $this->getType(), $params); - if ($number) { - return $number; + if (is_int($num)) { + return $num; } else { return $this->getAnnotationCalculation('generic_comment', 'count'); } -- cgit v1.2.3