From: dave Date: Sat, 19 Jun 2010 11:55:08 +0000 (+0000) Subject: included an option to display existing comments but not show the new comment form. X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=6a467a7653d1f6edb810e7f680b8001022c54228;p=lorea%2Felgg.git included an option to display existing comments but not show the new comment form. git-svn-id: http://code.elgg.org/elgg/trunk@6521 36083f99-b078-4883-b0ff-0f9b5a30f544 --- diff --git a/engine/lib/views.php b/engine/lib/views.php index 035038641..60078fa7a 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -807,9 +807,10 @@ function elgg_view_title($title, $submenu = false) { * Automatically views comments and a comment form relating to the given entity * * @param ElggEntity $entity The entity to comment on + * @param $add_comment Whether or not you want users to add more comments * @return string|false The HTML (etc) for the comments, or false on failure */ -function elgg_view_comments($entity){ +function elgg_view_comments($entity, $add_comment = true){ if (!($entity instanceof ElggEntity)) { return false; @@ -820,8 +821,10 @@ function elgg_view_comments($entity){ } else { $comments = list_annotations($entity->getGUID(),'generic_comment'); - //display the comment form - $comments .= elgg_view('comments/forms/edit',array('entity' => $entity)); + //display the new comment form if required + if($add_comment){ + $comments .= elgg_view('comments/forms/edit',array('entity' => $entity)); + } return $comments; }