I'm writing a queued cron process, and need to retrieve some information while doing this. Rather than fiddling around with DB queries, it seemed to me much easier to create a View and then execute it in the code. Which I did (and by the way, the View itself works fine and returns the expected result). Trouble is, although it seems to run fine, it returns no result.
I've tried two different ways of doing this, but both are the same: the result is empty.
First was very simple:
if (!isset($node->og_group_ref)) {
$regions = views_get_view_result('og_regions');
}
That left $regions empty, so I tried this, with no better result:
if (!isset($node->og_group_ref)) {
$view = views_get_view('og_regions');
$view->execute();
$regions = $view->result;
}