Override a view definition programmatically I want to override a view definition programmatically (using the code that I get from "view export" in the views admin pages). 

I've found examples for creating views using views_new_view(), but nothing on modifying views definition programmatically. Are there any examples / tutorials on this ?

Can I do this with views_get_view($name) / views_save_view() ?
Ok, I got to a working solution : 

$my_view_name = 'my_test_view';

$view = views_get_view($my_view_name);
if ( $view ) {
  views_delete_view($view);
}

// ... code from view export UI ... 

$view-&gt;save();


If the view exists already then I delete it before recreating it.   

Then I throw in the code taken from the views export UI, and add right after a $view-&gt;save();

And that does it.