A view I wrote has bugged handlers so I want to alter the query manually. How do I get the current view display? The view handler for locations is broken when the locations are in field collections.

I need to rewrite the view query, replacing 3 joins with 2 other joins, for the query to work.

I don't want to mess with other displays of the view - how do I get the currently used display with hook_views_query_alter()?
If you already know the machine name of the view then you can wrap your code in an if statement.

function hook_views_query_alter(&amp;$view, &amp;$query){
    if($view-&gt;name == 'name_of_view_to_alter'){
        //do stuff to the query
    }
}


hook_views_query_alter takes two arguments &amp;$view and &amp;$query. If you don't already know the machine name, of course install devel and use dsm($view) to find what you need. Also very helpful calling that on the $query variable as well. I just did something very similar.