How to exclude nodes from views result?
Ok, so this was in fact very simple... though it took me a great deal of time to find the solution. I removed the snippet in the custom module above and instead I added the code below in template.php. Hope it helps somebody. I found the solution here: http://agaric.com/blogs/altering-views-results

function mytheme_views_pre_render(&amp;$view) {      
if ($view-&gt;name === 'myview' &amp;&amp; $view-&gt;current_display === 'mydisplay') {
        foreach($view-&gt;result as $index=&gt;$val){
          $product_node = node_load($val-&gt;field_data_field_related_product_nid);
          if($product_node-&gt;status === '0'){
             unset($view-&gt;result[$index]);
          }
        }
    }
}