Exposed filter checkbox for "has comments" I would like to add a checkbox as an exposed filter to my view. When checked it will show all ndoes with 0 comments.

I looked at BEF but it didn't seem to be able to handle this.
I also have another exposed filter for that view, otherwise I could just hide the filter and use jquery to toggle the url when checking the checkbox.
You can add your own filter trough a custom module. I was in need of the same thing. The following code should work.


&lt;?php
/**
 * Implements hook_views_api()
 */
function my_module_views_api() {
  return array(
    'api' =&gt; 3,
  );
}



/**
* Implements hook_views_data().
*/
function mymodule_views_data() {

  // comment_count
  $data['node_comment_statistics']['has_comment'] = array(
    'title' =&gt; t('Has comment'),
    'real field' =&gt; 'comment_count',
    'help' =&gt; t('Filter to see if entity has comments.'),
    'filter' =&gt; array(
      'handler' =&gt; 'cjsm_ikz_handler_filter_has_comments',
    ),
  );

  return $data;
}


The next thing should be a filter in an include file.

&lt;?php
/**
* @file
* Definition of mymodule_handler_filter_has_comments.
*/

/**
 * Simple filter to see if entity has comments or not.
 *
 * @ingroup views_filter_handlers
 */
class mymodule_handler_filter_has_comments extends views_handler_filter_boolean_operator {
  function query() {
    $this-&gt;ensure_my_table();
    $field = "$this-&gt;table_alias.$this-&gt;real_field";

    if (empty($this-&gt;value)) {
      if ($this-&gt;accept_null) {
        $or = db_or()
        -&gt;condition($field, 0, '=')
        -&gt;condition($field, NULL, 'IS NULL');
        $this-&gt;query-&gt;add_where($this-&gt;options['group'], $or);
      }
      else {
        $this-&gt;query-&gt;add_where($this-&gt;options['group'], $field, 0, '=');
      }
    }
    else {
      $this-&gt;query-&gt;add_where($this-&gt;options['group'], $field, 0, '&lt;&gt;');
    }
  }
}


For me this is providing a selectbox. Because I also want to be able to see nodes with and without comments at the same time. But it does exactly what you are looking for. If you are having trouble implementing this I suggest you search for the ins and outs of creating custom views filters.