Make sure content of every view is published I'd like to set a query alter function that checks if the node.status condition is already set in the view's query, and if it's not I'd like to set it to only get published content. The following code doesn't seem to running on my app. Do you have any suggestions to make this work?

function hook_views_query_alter(&amp;$view, &amp;$query) {

    $found = false;

    foreach($query-&gt;condition as $condition) {
        if($condition = 'node.status') {
            $found = true;
        }
    }

    if(!$found) {
        $this-&gt;query-&gt;add_where(
            $this-&gt;options['group'],
            db_or()-&gt;condition('node.status', 1, '=')
        );
    }


I have > 100 views to implement this change on.
Why not just set a filter in the View configuration and set Status as Published?