For myself, this is a handy feature to have, so I added it to my module. I did this by adding the following code to comment.views.inc where comment pid is defined:

$data['comments']['pid'] = array(

... snipped ...

'filter' => array(
'handler' => 'views_handler_filter_numeric',
),

... snipped ...

);

Comments

It currently works fine if you use relationships.
It makes sense for me to let users use the relationships because they are a very very powerful system if you get into it.

Status:Active» Closed (works as designed)

Changing status based on comment #1

Version:6.x-2.11» 6.x-2.14
Status:Closed (works as designed)» Needs review

Hi

Using relationship and enabling 'Parent CID' does help, but not fully. It works in the case when one selects the Comment ID (cid) in the filter and sets a value '!= 0' - this will fetch comments which have parents (ie., pid != 0). But to locate 'parent-less comments', ie., all comments that have 'pid = 0', the query always returns an empty result.

I believe it is due to the inner join in the query as below:

....
LEFT JOIN comments comments_comments ON comments.pid = comments_comments.cid
.... WHERE (comments_comments.cid = 0) ....

with cid = 0, no rows are fetched from comments_comments and this results in the empty resultset output of the view.

Can you please review this ?

Thanks
Venkat

Status:Needs review» Active

Review means that there is a patch.

DId you set required in the relationship?

Same issue.

With parent comment relationship (required), and nothing in filter => only shows children comments
With parent comment relationship (required), and "(parent)comment id" in filter => no results

I think #3 is right that the join is throwing it off, rather than comparing within the same table (views is treating it as two tables).

A hack, is to use a global php filter:

<?php
if ($row->pid != 0){
return
TRUE;
};
?>

I solve it this way:

  1. Put parent ID on the fields and hide it.
  2. On the filters add "Global: Combine fields filter" and select only de PID field and condition: equals 0