From 608647dcf59c60e55d86a69e39e2626e6f1eb6bc Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 3 Mar 2011 01:41:18 +0000 Subject: Refs #2679 - returning to a separate annotation for discussion forum replies. For those using the latest out of svn you can update with this script: https://gist.github.com/852092 git-svn-id: http://code.elgg.org/elgg/trunk@8570 36083f99-b078-4883-b0ff-0f9b5a30f544 --- .../views/default/object/groupforumtopic.php | 30 ++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'mod/groups/views/default/object') diff --git a/mod/groups/views/default/object/groupforumtopic.php b/mod/groups/views/default/object/groupforumtopic.php index 8a1daece8..b5efa0e6c 100644 --- a/mod/groups/views/default/object/groupforumtopic.php +++ b/mod/groups/views/default/object/groupforumtopic.php @@ -26,18 +26,22 @@ $poster_text = elgg_echo('groups:started', array($poster->name)); $tags = elgg_view('output/tags', array('tags' => $topic->tags)); $date = elgg_view_friendly_time($topic->time_created); -$comments_link = ''; -$comments_text = ''; -$num_comments = $topic->countComments(); -if ($num_comments != 0) { - $last_comment = $topic->getAnnotations("generic_comment", 1, 0, "desc"); - $commenter = $last_comment[0]->getOwnerEntity(); - $comment_time = elgg_view_friendly_time($last_comment[0]->time_created); - $comments_text = elgg_echo('groups:updated', array($commenter->name, $comment_time)); +$replies_link = ''; +$replies_text = ''; +$num_replies = elgg_get_annotations(array( + 'annotation_name' => 'group_topic_post', + 'guid' => $topic->getGUID(), + 'count' => true, +)); +if ($num_replies != 0) { + $last_reply = $topic->getAnnotations('group_topic_post', 1, 0, 'desc'); + $poster = $last_reply[0]->getOwnerEntity(); + $reply_time = elgg_view_friendly_time($last_reply[0]->time_created); + $reply_text = elgg_echo('groups:updated', array($poster->name, $reply_time)); - $comments_link = elgg_view('output/url', array( - 'href' => $topic->getURL() . '#topic-comments', - 'text' => elgg_echo("comments") . " ($num_comments)", + $replies_link = elgg_view('output/url', array( + 'href' => $topic->getURL() . '#group-replies', + 'text' => elgg_echo('group:replies') . " ($num_replies)", )); } @@ -52,7 +56,7 @@ if (elgg_in_context('widgets')) { } if ($full) { - $subtitle = "$poster_text $date $comments_link"; + $subtitle = "$poster_text $date $replies_link"; $params = array( 'entity' => $topic, @@ -75,7 +79,7 @@ HTML; } else { // brief view - $subtitle = "$poster_text $date $comments_link $comments_text"; + $subtitle = "$poster_text $date $replies_link $reply_text"; $params = array( 'entity' => $topic, -- cgit v1.2.3