Adding Where clause in Views Query using a custom filter Handler How can I add a where clause in custom filter handler for views query.

I need to add where clause to alter views query using custom filter handler.

My code in custom filter:

class fee_management_handler_filter_payment_status extends views_handler_filter_many_to_one {
  function get_value_options() {
    $this-&gt;value_options = array('1' =&gt; 'Paid', '0' =&gt; 'Unpaid');
  }

    /**
        * Called to implement a payment status.
    */  
    function query() {  

        if filter = unpaid or 0 

        view conditions  + = ' AND pid IS NULL';    

        parent::query();
    }
}
function query() {
        parent::ensure_my_table(); #$this-&gt;ensure_my_table();
        $alias = $this-&gt;table . '_' . $this-&gt;view-&gt;base_table;
        $operator = ($this-&gt;value['0']) ? 'IS NOT' : 'IS';
    $this-&gt;query-&gt;add_where(0, $alias . '.pid', NULL, $operator . ' NULL');
        #debug($this-&gt;query);   
        parent::query();
    }