Closed (fixed)
Project:
Taxonomy Access Control
Version:
5.x-1.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Nov 2007 at 17:10 UTC
Updated:
22 Oct 2009 at 02:22 UTC
I have a view page that is set to random and when viewed as administrator it functions as expected however when viewed as an anonymous user the individual items on the page get repeated. There is only one taxonomy term for generating this list and I've included node:distinct but that has no effect. Basically I'm getting two of each submission.
Same problem occurs with caching disabled.
View the page: http://www-new.onu.edu/alumni/get_involved/featured_people
Thanks for your help and my apologies if this is just something stupid on my part!
Ken Colwell
Views export:
$view = new stdClass();
$view->name = 'alumni_featured_people';
$view->description = '';
$view->access = array (
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = 'Featured Alumni';
$view->page_header = '';
$view->page_header_format = '3';
$view->page_footer = '';
$view->page_footer_format = '3';
$view->page_empty = '';
$view->page_empty_format = '3';
$view->page_type = 'teaser';
$view->url = 'alumni/get_involved/featured_people';
$view->use_pager = FALSE;
$view->nodes_per_page = '0';
$view->menu = TRUE;
$view->menu_title = 'Featured Alumni';
$view->menu_tab = FALSE;
$view->menu_tab_weight = '0';
$view->menu_tab_default = FALSE;
$view->menu_tab_default_parent = NULL;
$view->menu_tab_default_parent_type = 'normal';
$view->menu_parent_tab_weight = '0';
$view->menu_parent_title = '';
$view->block = TRUE;
$view->block_title = 'Featured Alumni';
$view->block_header = '';
$view->block_header_format = '3';
$view->block_footer = '';
$view->block_footer_format = '3';
$view->block_empty = '';
$view->block_empty_format = '3';
$view->block_type = 'teaser';
$view->nodes_per_block = '1';
$view->block_more = TRUE;
$view->block_use_page_header = FALSE;
$view->block_use_page_footer = FALSE;
$view->block_use_page_empty = FALSE;
$view->sort = array (
array (
'tablename' => 'node',
'field' => 'random',
'sortorder' => 'ASC',
'options' => '',
),
);
$view->argument = array (
);
$view->field = array (
array (
'tablename' => 'node',
'field' => 'title',
'label' => '',
'handler' => 'views_handler_field_nodelink',
'options' => 'link',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'distinct',
'operator' => '=',
'options' => '',
'value' => array (
0 => 'distinct',
),
),
array (
'tablename' => 'term_node_2',
'field' => 'tid',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => '1199',
),
),
array (
'tablename' => 'node',
'field' => 'distinct',
'operator' => '=',
'options' => '',
'value' => array (
0 => 'distinct',
),
),
);
$view->exposed_filter = array (
);
$view->requires = array(node, term_node_2);
$views[$view->name] = $view;
Comments
Comment #1
kcolwell commentedHas something to do with database queries and differences between the anonymous user and other users?
db query for anonymous users:
SELECT DISTINCT(node.nid), rand() AS random_sort FROM node LEFT JOIN term_node ON node.nid = term_node.nid LEFT JOIN term_hierarchy ON term_node.tid = term_hierarchy.tid INNER JOIN node_access na ON na.nid = node.nid LEFT JOIN node n ON node.nid = n.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'content_access_rid') OR (na.gid = 1 AND na.realm = 'job_view') OR (na.gid = 1 AND na.realm = 'term_access'))) AND ((n.moderate != 1)) AND ( (term_node.tid = '1199') ) ORDER BY random_sort ASC
db query for admin users:
SELECT DISTINCT(node.nid), rand() AS random_sort FROM node LEFT JOIN term_node ON node.nid = term_node.nid LEFT JOIN term_hierarchy ON term_node.tid = term_hierarchy.tid WHERE (term_node.tid IN ('1199')) GROUP BY node.nid, random_sort ORDER BY random_sort ASC
Comment #2
kcolwell commentedOk... I've tracked down the above database select statements to find that the extra parameters passed when the view is accessed by anonymous users is being caused by taxonomy access control. In fact disabling taxonomy access control makes the problem completely go away. Of course I really need tac. So now I'm more educated about the problem but still don't have a solution.
If anyone can provide some help it would be greatly appreciated.
Thanks,
Ken Colwell
Comment #3
kcolwell commentedI still think this is a bug with views or taxonomy access control.
But I found that if I used tac to set the permissions for the specific taxonomy term to ignore and then enabled view all views in the anonymous users role the duplication of the nodes that were set to be sorted by random stopped.
I don't exactly have any idea why this worked but it changed the select statement for anonymous users to something that didn't select everything twice.
So that was 2 days of my life down the drain.
Thanks,
Ken Colwell
Comment #4
kcolwell commentedCross posting from this url: http://drupal.org/node/195445
Comment #5
onelittleant commentedDefault random sort in views 1 is not repeatable, and shows duplicate results on sequential pages. See below for a solution:
http://drupal.org/node/266791#comment-975665
Comment #6
kcolwell commented