object_guid); //get object url $object_url = $object->getURL(); $numoflikes = elgg_count_likes($object); //user //if displaying on the profile get the object owner, else the subject_guid if (get_context() == 'profile' && $object->getSubtype() == 'thewire') { $user = get_entity($object->owner_guid); } else { $user = get_entity($vars['item']->subject_guid); } //count comment annotations $comment_count = count_annotations($vars['item']->object_guid, $vars['item']->type, $vars['item']->subtype, $annotation_comment); //get last three comments display $get_comments = get_annotations($vars['item']->object_guid, "", "", 'generic_comment', "", "", 3, 0, "desc"); if ($get_comments){ //reverse the array so we can display comments in the right order $get_comments = array_reverse($get_comments); } //minus 3 off the comment total as we display 3 by default if ($comment_count < 3) { $num_comments = 0; } else { $num_comments = $comment_count - 3; } ?>
$user, 'size' => 'small')); ?>
"; if ($comment_count <= 3) { echo "Comments"; } //display 'more comments' if there are any if ($num_comments != 0) { echo "Comments (+{$num_comments} more)"; } if ($numoflikes != 0) { echo elgg_view('likes/forms/display', array('entity' => $object)); } echo "
"; // close river_comments_tabs echo "
"; if ($numoflikes != 0) { //show the users who liked the object echo ""; } foreach ($get_comments as $gc) { //get the comment owner $comment_owner = get_user($gc->owner_guid); //get the comment owner's profile url $comment_owner_url = $comment_owner->getURL(); // color-code each of the 3 comments if( ($counter == 2 && $comment_count >= 4) || ($counter == 1 && $comment_count == 2) || ($counter == 0 && $comment_count == 1) || ($counter == 2 && $comment_count == 3) ) { $alt = 'latest'; } else if( ($counter == 1 && $comment_count >= 4) || ($counter == 0 && $comment_count == 2) || ($counter == 1 && $comment_count == 3) ) { $alt = 'penultimate'; } //display comment echo "
"; echo ""; echo elgg_view("profile/icon", array('entity' => $comment_owner, 'size' => 'tiny')); echo ""; //truncate comment to 150 characters if (strlen($gc->value) > 150) { $gc->value = substr($gc->value, 0, strpos($gc->value, ' ', 150)) . "…"; } $contents = strip_tags($gc->value); echo "
"; echo "" . $comment_owner->name . " " . parse_urls($contents); echo "" . friendly_time($gc->time_created) . ""; echo "
"; $counter++; } echo elgg_make_river_comment($object); echo "
"; // close river_comments } else { // tab bar nav - for users that liked object $numoflikes = elgg_count_likes($object); if ($vars['item']->type != 'user' && $numoflikes != 0) { echo "
"; } if ($numoflikes != 0) { echo elgg_view('likes/forms/display', array('entity' => $object)); } if ($vars['item']->type != 'user' && $numoflikes != 0) { echo "
"; // close river_comments_tabs } if ($vars['item']->type != 'user') { echo "
"; } if ($numoflikes != 0) { //show the users who liked the object echo ""; } // if there are no comments to display // and this is not a user or a group discussion entry - include the inline comment form if ($vars['item']->type != 'user' && $vars['item']->subtype != 'groupforumtopic') { echo elgg_make_river_comment($object); } if ($vars['item']->type != 'user') { echo "
"; } } echo "
"; // close river_item_contents ?>