By seth97 on
Hi,
I have done an image gallery for each group (Organic Groups) using CCK and Views as explained here: http://drupal.org/node/144725
I have created a content type 'image' and when group members submit an 'image' it is placed in the galley of that group.
Everything works fine except for one detail:
When a user submits an 'image' in a group the image is shown twice in the gallery, if 'Public' is checked in the submission (if 'Public' is unchecked it works fine).
If I am logged in as 'site admin' the gallery looks fine, but if I login as 'authenticated user' I see an extra copy of all 'Public' images.
This is the View that I created:
$view = new stdClass();
$view->name = 'Gallery_Groups';
$view->description = 'Image Gallery for Groups';
$view->access = array (
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = 'Image Gallery';
$view->page_header = '';
$view->page_header_format = '3';
$view->page_footer = '';
$view->page_footer_format = '3';
$view->page_empty = 'No image gallery available for this group.
';
$view->page_empty_format = '3';
$view->page_type = 'bonus_grid';
$view->url = 'node/$group/gallery';
$view->use_pager = TRUE;
$view->nodes_per_page = '48';
$view->sort = array (
array (
'tablename' => 'node',
'field' => 'random',
'sortorder' => 'ASC',
'options' => '',
),
);
$view->argument = array (
);
$view->field = array (
array (
'tablename' => 'node_data_field_image',
'field' => 'field_image_fid',
'label' => '',
'handler' => 'content_views_field_handler_ungroup',
'options' => 'thickbox][SquareThumbnails',
),
array (
'tablename' => 'node',
'field' => 'title',
'label' => '',
'handler' => 'views_handler_field_nodelink',
'options' => 'nolink',
),
array (
'tablename' => 'node',
'field' => 'edit',
'label' => '',
'handler' => 'views_handler_node_edit',
'options' => 'edit',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
array (
'tablename' => 'node',
'field' => 'type',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => 'image',
),
),
array (
'tablename' => 'og_ancestry',
'field' => 'picg',
'operator' => '=',
'options' => '',
'value' => '***CURRENT_GID***',
),
);
$view->exposed_filter = array (
);
$view->requires = array(node, node_data_field_image, og_ancestry);
$views[$view->name] = $view;
Any suggestions?
Thanks!
Seth
Comments
Node Distinct
I don't use organic groups, so I can help with that specifically, but maybe it would help to add a "Node Distinct" filter on the view. I outlined this in my View instructions. That should make nodes (or the thumbnail field for the node) only list once.
doesn't help....
Thanks konsumer,
That seems like a good suggestion, but "Node Distinct" doesn't help in my case, I still get duplicates for 'Public' images.
In the "Node Distinct" filter it says 'Use this if multiple taxonomy matches return duplicated nodes'. So does it only help for taxonomy?
Any ideas why the View looks different for site admin and authenticated users?
/Seth
Not much...
advice, but this appears like an interaction b/w views and og. I've never seen duplicate images showing up - your view looks fine. I don't use OG, so can't speak to that.
Sorry Seth, I can't offer much, but if it were me, the debug strategy I would start with would be to de-couple the view from OG and ensure it works (get rid of OG filter?) If you still get duplicates, then I may be able to help further. If not, at least you've isolated the problem to the OG filter, and can seek support on the appropriate issue queue.
Good luck!
thanks
thanks jfall,
I will try your suggestion!
Check this out...
Views Issue: Duplicate entry displayed in a view http://drupal.org/node/163889
Could this be related? There is a patch posted - perhaps you've run across the same bug?
Good luck
Random - My problem
Hi,
Thank you all for your suggestions!
In my case the problem seemed to be the 'Sort Criteria'. Previously I had set it to 'Random', that's when I got the duplicates as described in this thread.
Now I changed it to 'Comment: Created Time' and everything works fine!
Quite strange, but now everything works! Maybe it is related to the 'View Issue' that jfall described, I didn't check it carefully.
Thanks,
Seth
but this still doesn't
but this still doesn't resolve the 'random node filter'-error
did you try the patch?
Did you try the patch that jfall suggested?
I haven't tried it myself, I just skipped the random sorting.
http://drupal.org/node/163889#comment-688412