? views_comment.inc-patch
Index: views_comment.inc
===================================================================
RCS file: /usr/java/cvs/parenting-vbulletin/blogs/modules/views/modules/views_comment.inc,v
retrieving revision 1.1
diff -u -r1.1 views_comment.inc
--- blogs/modules/views/modules/views_comment.inc	19 Dec 2007 21:05:24 -0000	1.1
+++ blogs/modules/views/modules/views_comment.inc	8 Feb 2008 22:42:53 -0000
@@ -76,7 +76,16 @@
         'list' => 'views_handler_operator_yesno',
         'list-type' => 'select',
         ),
-    ),
+        'comment_distinct' => array(
+			'name' => t('Comment: Distinct'),
+			'operator' => array('=' => 'is'),
+			'list' => array('distinct' => 'distinct'),
+			'handler' => 'views_handler_filter_comment_distinct',
+			'value-type' => 'array',
+			'help' => t('This filter ensures that each comment may only be listed once, even if it matches multiple criteria. Use this if multiple comments are displaying with the same Comment ID.'),
+      	),
+      
+   ),
     'sorts' => array(
       'timestamp' => array(
         'name' => t('Comment: Created Time'),
@@ -230,6 +239,13 @@
   return theme('username', $obj);
 }
 
+function views_handler_filter_comment_distinct($op, $filter, $filterinfo, &$query) {
+	if (!$query->no_distinct) {
+		$query->set_distinct();
+    	$query->add_groupby('comments.cid');
+	}
+}
+
 /*
  * Format a field as a link to a comment.
  */
