]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
included an option to display existing comments but not show the new comment form.
authordave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 19 Jun 2010 11:55:08 +0000 (11:55 +0000)
committerdave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 19 Jun 2010 11:55:08 +0000 (11:55 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@6521 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/views.php

index 035038641f62e14f0c80bdf5913ab9b0f220edbe..60078fa7a212ec6d9690566c6e1d9260f87bc0b7 100644 (file)
@@ -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;
        }