I created a very simple view using the views module (see later exported). When I try to see the result no image galleries are shown (nothing is shown besides the breadcrumb and the view title). If I create a view with the filter "Node: Author is Current User" then all of the nodes of the current user is shown including image galleries. So perhaps it is a problem with the filter "Node images: Has node images", isn't it?
I am using Drupal 5.1, PHP 5.2.1, views 5.x-1.5 (2007-Jan-22), and node_images 5.x-1.x-dev.
This is the end of the page source:
This is the view that does not work:
$view = new stdClass();
$view->name = 'my_galleries';
$view->description = 'My galleries';
$view->access = array (
0 => '2',
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = 'My gallery';
$view->page_header = '';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = '';
$view->page_empty_format = '1';
$view->page_type = 'node';
$view->url = 'photos/my';
$view->use_pager = TRUE;
$view->nodes_per_page = '10';
$view->menu = TRUE;
$view->menu_title = '*** my galleries ***';
$view->menu_tab = FALSE;
$view->menu_tab_default = FALSE;
$view->menu_tab_weight = '0';
$view->sort = array (
);
$view->argument = array (
);
$view->field = array (
);
$view->filter = array (
array (
'tablename' => 'node_images',
'field' => 'nid',
'operator' => '=',
'options' => '',
'value' => '1',
),
);
$view->exposed_filter = array (
);
$view->requires = array(node_images);
$views[$view->name] = $view;
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | end_of_page_source.txt | 359 bytes | attila75 |
Comments
Comment #1
attila75 commentedAttaching the end of the page source as a text file.
Comment #2
attila75 commentedIf I expose the filter it works all right. Strange. Maybe a views bug. Investigating further...
Comment #3
attila75 commentedI've debugged the problem. This is what happens:
When you save the view, the field "query" in table "view_view" gets generated wrongly (with an additional "where" clause, although it's not needed). This happens because in line 129 of views_query.inc function_exists() does not find "_node_images_handler_images_exist" although it is implemented in file node_images.views.inc.
If you expose the query it becomes non-cacheable and the above line will be called from elsewhere and it will work.
A colleague of mine suggested to take a look at the buddylist module where they inlcude their buddylist_views.inc file at the beginning of their .module file. So to apply their solution to node_images module you need to insert the following lines to the beginning of node_images.module:
if (module_exists('views')) {
include_once('node_images.views.inc');
}
This seems to fix this bug. But if you know a better fix for this bug it is of course welcome.
Comment #4
stefano73 commented