aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authordave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-19 11:55:08 +0000
committerdave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-19 11:55:08 +0000
commit6a467a7653d1f6edb810e7f680b8001022c54228 (patch)
treefedbfb4369f352274adc5f3469c9041f516df75f /engine
parent53305ecf5ccd83618faebedb1ae9ef8e0ce61d8c (diff)
downloadelgg-6a467a7653d1f6edb810e7f680b8001022c54228.tar.gz
elgg-6a467a7653d1f6edb810e7f680b8001022c54228.tar.bz2
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
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/views.php9
1 files changed, 6 insertions, 3 deletions
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;
}