Thank you for this great contribution. I was unable at first to figure out how to build a view and have it skip access permissions. The trick to get it working was to call views_ignore_node_permissions_views_pre_render() AFTER executing the view. Just wanted to share it here in case anyone else needs it.
$view = views_get_view('YOUR_VIEW_NAME');
$view->set_arguments(array('YOUR_ARGS'));
$view->execute('DESIRED_DISPLAY'); // e.g., 'default' or 'page_1'
$function = views_ignore_node_permissions_views_pre_render(&$view); // This feeds it through this module's implementation of hook_views_pre_render() allowing for permissions to be ignored
if (!empty($view->result)) {
// Do something if the view has a result
}
There may be a better way, but this one worked for me. Thanks again for the module!
Comments
Comment #1
kenorb commentedThis issue is few years old and features of this module Views has it built-in by default now (Disable SQL rewriting).
Comment #2
jvieille commentedThank you very much for submitting this !