The Problem:
I have 20 results when I am Authenticated. When Unauthenticated I have 7 results. I want them both to show all 20. This is not a permissions issue, as you will see below.
The Facts:
- All the Nodes in the View have the option to have an Entity Reference to another Node.
- If the Node does has a an Entity Reference to another node, it will show up in the Unauthenticated results.
- I am using a Relationship and a Contextual filter.
- If I delete my Relationship I see all 20 results when Unauthenticated. This relationship is already not marked as "Require this Relationship".
I have already checked and totally ruled out this being a User Permissions issue related to specific Pages or nodes of x Content Type. All the the Nodes referenced are Published and the Unauthenticated use has Permission to see all content. I think its a quirk related to Relationships and Contextual Filters.
Why? How can I get them to show the same results? I have spent 8 hours trying to find a solution. I am losing my mind... lol
Any help or troubleshooting ideas would be welcomed and greatly appreciated. The Page part of the View Export is below, the entire View Export is attached.
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['title'] = 'Announcements';
$handler->display->display_options['defaults']['query'] = FALSE;
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['distinct'] = TRUE;
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['style_options']['row_class'] = 'clearfix';
$handler->display->display_options['style_options']['row_class_special'] = FALSE;
$handler->display->display_options['defaults']['style_options'] = FALSE;
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['defaults']['row_options'] = FALSE;
$handler->display->display_options['defaults']['header'] = FALSE;
$handler->display->display_options['defaults']['footer'] = FALSE;
$handler->display->display_options['defaults']['empty'] = FALSE;
/* No results behavior: Global: Text area */
$handler->display->display_options['empty']['area']['id'] = 'area';
$handler->display->display_options['empty']['area']['table'] = 'views';
$handler->display->display_options['empty']['area']['field'] = 'area';
$handler->display->display_options['empty']['area']['empty'] = TRUE;
$handler->display->display_options['empty']['area']['content'] = 'No matches found for your search. Removing filters may increase your results.';
$handler->display->display_options['empty']['area']['format'] = 'filtered_html';
$handler->display->display_options['defaults']['relationships'] = FALSE;
/* Relationship: Entity Reference: Referenced Entity */
$handler->display->display_options['relationships']['core__member__ref_target_id']['id'] = 'core__member__ref_target_id';
$handler->display->display_options['relationships']['core__member__ref_target_id']['table'] = 'field_data_core__member__ref';
$handler->display->display_options['relationships']['core__member__ref_target_id']['field'] = 'core__member__ref_target_id';
$handler->display->display_options['defaults']['fields'] = FALSE;
/* Field: Content: Feature Image Thumb */
$handler->display->display_options['fields']['core__thumb_image']['id'] = 'core__thumb_image';
$handler->display->display_options['fields']['core__thumb_image']['table'] = 'field_data_core__thumb_image';
$handler->display->display_options['fields']['core__thumb_image']['field'] = 'core__thumb_image';
$handler->display->display_options['fields']['core__thumb_image']['label'] = '';
$handler->display->display_options['fields']['core__thumb_image']['element_type'] = '0';
$handler->display->display_options['fields']['core__thumb_image']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['core__thumb_image']['element_wrapper_type'] = '0';
$handler->display->display_options['fields']['core__thumb_image']['element_default_classes'] = FALSE;
$handler->display->display_options['fields']['core__thumb_image']['click_sort_column'] = 'fid';
$handler->display->display_options['fields']['core__thumb_image']['settings'] = array(
'image_style' => '',
'image_link' => '',
);
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['title']['element_type'] = 'h2';
$handler->display->display_options['fields']['title']['element_label_type'] = '0';
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['title']['element_wrapper_type'] = '0';
$handler->display->display_options['fields']['title']['element_default_classes'] = FALSE;
/* Field: Content: Core Date */
$handler->display->display_options['fields']['core__date']['id'] = 'core__date';
$handler->display->display_options['fields']['core__date']['table'] = 'field_data_core__date';
$handler->display->display_options['fields']['core__date']['field'] = 'core__date';
$handler->display->display_options['fields']['core__date']['label'] = '';
$handler->display->display_options['fields']['core__date']['element_type'] = '0';
$handler->display->display_options['fields']['core__date']['element_label_type'] = '0';
$handler->display->display_options['fields']['core__date']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['core__date']['element_wrapper_type'] = '0';
$handler->display->display_options['fields']['core__date']['element_default_classes'] = FALSE;
$handler->display->display_options['fields']['core__date']['settings'] = array(
'format_type' => 'long',
'fromto' => 'both',
'multiple_number' => '',
'multiple_from' => '',
'multiple_to' => '',
);
/* Field: Content: Description */
$handler->display->display_options['fields']['body']['id'] = 'body';
$handler->display->display_options['fields']['body']['table'] = 'field_data_body';
$handler->display->display_options['fields']['body']['field'] = 'body';
$handler->display->display_options['fields']['body']['label'] = '';
$handler->display->display_options['fields']['body']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['body']['type'] = 'text_summary_or_trimmed';
$handler->display->display_options['fields']['body']['settings'] = array(
'trim_length' => '300',
);
$handler->display->display_options['defaults']['sorts'] = FALSE;
/* Sort criterion: Content: Core Date (core__date) */
$handler->display->display_options['sorts']['core__date_value']['id'] = 'core__date_value';
$handler->display->display_options['sorts']['core__date_value']['table'] = 'field_data_core__date';
$handler->display->display_options['sorts']['core__date_value']['field'] = 'core__date_value';
$handler->display->display_options['sorts']['core__date_value']['order'] = 'DESC';
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
$handler->display->display_options['defaults']['arguments'] = FALSE;
/* Contextual filter: Content: Presenter(s) (core__member__ref) */
$handler->display->display_options['arguments']['core__member__ref_target_id']['id'] = 'core__member__ref_target_id';
$handler->display->display_options['arguments']['core__member__ref_target_id']['table'] = 'field_data_core__member__ref';
$handler->display->display_options['arguments']['core__member__ref_target_id']['field'] = 'core__member__ref_target_id';
$handler->display->display_options['arguments']['core__member__ref_target_id']['breadcrumb'] = '%2';
$handler->display->display_options['arguments']['core__member__ref_target_id']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['core__member__ref_target_id']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['core__member__ref_target_id']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['core__member__ref_target_id']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['defaults']['filter_groups'] = FALSE;
$handler->display->display_options['defaults']['filters'] = FALSE;
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'article' => 'article',
);
$handler->display->display_options['filters']['type']['group'] = 1;
/* Filter criterion: Global: Combine fields filter */
$handler->display->display_options['filters']['combine']['id'] = 'combine';
$handler->display->display_options['filters']['combine']['table'] = 'views';
$handler->display->display_options['filters']['combine']['field'] = 'combine';
$handler->display->display_options['filters']['combine']['operator'] = 'allwords';
$handler->display->display_options['filters']['combine']['group'] = 1;
$handler->display->display_options['filters']['combine']['exposed'] = TRUE;
$handler->display->display_options['filters']['combine']['expose']['operator_id'] = 'combine_op';
$handler->display->display_options['filters']['combine']['expose']['label'] = 'Search';
$handler->display->display_options['filters']['combine']['expose']['operator'] = 'combine_op';
$handler->display->display_options['filters']['combine']['expose']['identifier'] = 'combine';
$handler->display->display_options['filters']['combine']['expose']['remember_roles'] = array(
2 => '2',
1 => 0,
9 => 0,
8 => 0,
7 => 0,
6 => 0,
5 => 0,
4 => 0,
10 => 0,
);
$handler->display->display_options['filters']['combine']['group_info']['label'] = 'Combine fields filter';
$handler->display->display_options['filters']['combine']['group_info']['identifier'] = 'combine';
$handler->display->display_options['filters']['combine']['group_info']['remember'] = FALSE;
$handler->display->display_options['filters']['combine']['group_info']['group_items'] = array(
1 => array(),
2 => array(),
3 => array(),
);
$handler->display->display_options['filters']['combine']['fields'] = array(
'title' => 'title',
'body' => 'body',
);
/* Filter criterion: Content: Article type (article__type_of) */
$handler->display->display_options['filters']['article__type_of_tid']['id'] = 'article__type_of_tid';
$handler->display->display_options['filters']['article__type_of_tid']['table'] = 'field_data_article__type_of';
$handler->display->display_options['filters']['article__type_of_tid']['field'] = 'article__type_of_tid';
$handler->display->display_options['filters']['article__type_of_tid']['group'] = 1;
$handler->display->display_options['filters']['article__type_of_tid']['exposed'] = TRUE;
$handler->display->display_options['filters']['article__type_of_tid']['expose']['operator_id'] = 'article__type_of_tid_op';
$handler->display->display_options['filters']['article__type_of_tid']['expose']['label'] = 'Announcement Type';
$handler->display->display_options['filters']['article__type_of_tid']['expose']['operator'] = 'article__type_of_tid_op';
$handler->display->display_options['filters']['article__type_of_tid']['expose']['identifier'] = 'article__type_of_tid';
$handler->display->display_options['filters']['article__type_of_tid']['expose']['remember_roles'] = array(
2 => '2',
1 => 0,
9 => 0,
8 => 0,
7 => 0,
6 => 0,
5 => 0,
4 => 0,
10 => 0,
);
$handler->display->display_options['filters']['article__type_of_tid']['reduce_duplicates'] = TRUE;
$handler->display->display_options['filters']['article__type_of_tid']['type'] = 'select';
$handler->display->display_options['filters']['article__type_of_tid']['vocabulary'] = 'article__type_of';
$handler->display->display_options['filters']['article__type_of_tid']['hierarchy'] = 1;
/* Filter criterion: Field: Duke AHEAD mission (core__mission) */
$handler->display->display_options['filters']['core__mission_tid']['id'] = 'core__mission_tid';
$handler->display->display_options['filters']['core__mission_tid']['table'] = 'field_data_core__mission';
$handler->display->display_options['filters']['core__mission_tid']['field'] = 'core__mission_tid';
$handler->display->display_options['filters']['core__mission_tid']['group'] = 1;
$handler->display->display_options['filters']['core__mission_tid']['exposed'] = TRUE;
$handler->display->display_options['filters']['core__mission_tid']['expose']['operator_id'] = 'core__mission_tid_op';
$handler->display->display_options['filters']['core__mission_tid']['expose']['label'] = 'Mission';
$handler->display->display_options['filters']['core__mission_tid']['expose']['operator'] = 'core__mission_tid_op';
$handler->display->display_options['filters']['core__mission_tid']['expose']['identifier'] = 'core__mission_tid';
$handler->display->display_options['filters']['core__mission_tid']['expose']['remember_roles'] = array(
2 => '2',
1 => 0,
9 => 0,
8 => 0,
7 => 0,
6 => 0,
5 => 0,
4 => 0,
10 => 0,
);
$handler->display->display_options['filters']['core__mission_tid']['type'] = 'select';
$handler->display->display_options['filters']['core__mission_tid']['vocabulary'] = 'mission';
$handler->display->display_options['filters']['core__mission_tid']['hierarchy'] = 1;
/* Filter criterion: Field: Educator competencies (core__edu_comp) */
$handler->display->display_options['filters']['core__edu_comp_tid']['id'] = 'core__edu_comp_tid';
$handler->display->display_options['filters']['core__edu_comp_tid']['table'] = 'field_data_core__edu_comp';
$handler->display->display_options['filters']['core__edu_comp_tid']['field'] = 'core__edu_comp_tid';
$handler->display->display_options['filters']['core__edu_comp_tid']['group'] = 1;
$handler->display->display_options['filters']['core__edu_comp_tid']['exposed'] = TRUE;
$handler->display->display_options['filters']['core__edu_comp_tid']['expose']['operator_id'] = 'core__edu_comp_tid_op';
$handler->display->display_options['filters']['core__edu_comp_tid']['expose']['label'] = 'Education Competency';
$handler->display->display_options['filters']['core__edu_comp_tid']['expose']['operator'] = 'core__edu_comp_tid_op';
$handler->display->display_options['filters']['core__edu_comp_tid']['expose']['identifier'] = 'core__edu_comp_tid';
$handler->display->display_options['filters']['core__edu_comp_tid']['expose']['remember_roles'] = array(
2 => '2',
1 => 0,
9 => 0,
8 => 0,
7 => 0,
6 => 0,
5 => 0,
4 => 0,
);
$handler->display->display_options['filters']['core__edu_comp_tid']['type'] = 'select';
$handler->display->display_options['filters']['core__edu_comp_tid']['vocabulary'] = 'edu_comp';
$handler->display->display_options['filters']['core__edu_comp_tid']['hierarchy'] = 1;
/* Filter criterion: Field: Related groups (core__group) */
$handler->display->display_options['filters']['core__group_tid']['id'] = 'core__group_tid';
$handler->display->display_options['filters']['core__group_tid']['table'] = 'field_data_core__group';
$handler->display->display_options['filters']['core__group_tid']['field'] = 'core__group_tid';
$handler->display->display_options['filters']['core__group_tid']['group'] = 1;
$handler->display->display_options['filters']['core__group_tid']['exposed'] = TRUE;
$handler->display->display_options['filters']['core__group_tid']['expose']['operator_id'] = 'core__group_tid_op';
$handler->display->display_options['filters']['core__group_tid']['expose']['label'] = 'Group';
$handler->display->display_options['filters']['core__group_tid']['expose']['operator'] = 'core__group_tid_op';
$handler->display->display_options['filters']['core__group_tid']['expose']['identifier'] = 'core__group_tid';
$handler->display->display_options['filters']['core__group_tid']['expose']['remember_roles'] = array(
2 => '2',
1 => 0,
9 => 0,
8 => 0,
7 => 0,
6 => 0,
5 => 0,
4 => 0,
10 => 0,
);
$handler->display->display_options['filters']['core__group_tid']['type'] = 'select';
$handler->display->display_options['filters']['core__group_tid']['vocabulary'] = 'group';
$handler->display->display_options['filters']['core__group_tid']['hierarchy'] = 1;
/* Filter criterion: Content: Core Date (core__date) */
$handler->display->display_options['filters']['core__date_value']['id'] = 'core__date_value';
$handler->display->display_options['filters']['core__date_value']['table'] = 'field_data_core__date';
$handler->display->display_options['filters']['core__date_value']['field'] = 'core__date_value';
$handler->display->display_options['filters']['core__date_value']['operator'] = '<=';
$handler->display->display_options['filters']['core__date_value']['group'] = 1;
$handler->display->display_options['filters']['core__date_value']['granularity'] = 'minute';
$handler->display->display_options['filters']['core__date_value']['form_type'] = 'date_text';
$handler->display->display_options['filters']['core__date_value']['default_date'] = 'now';
$handler->display->display_options['path'] = 'events-announcements/announcements';
Thanks in advance!
| Comment | File | Size | Author |
|---|---|---|---|
| exported_view.txt | 27.44 KB | joelhsmith |
Comments
Comment #1
joelhsmith commentedComment #2
joelhsmith commentedFor those who may run across this issue in the future...
I was using the View Unpublished module.
The View Unpublished module can get confused when there is an Entity Reference involved.
For example, if your View has an Entity Reference Relationship, and some of the Nodes from the base table don't reference anything, those nodes will not show up in the View. This happens for all users who aren't admin, so not just unauthenticated users.
Related post https://www.drupal.org/node/2390703
In spite of my emphatic declaration that is was not a permissions issue, it sorta was.
If you need to use View Unpublished type functionality, Your options at the moment are:
1. Look into using the Workbench module which offers similar functionality,
2. Or go to your View "Query options" and "Disable SQL rewriting" (only do this if you understand its potential risks).
Case closed :-)
Comment #3
joelhsmith commentedComment #4
crutch commentedUnsure if this is same issue but definitely seems similar. Using View Unpublished module. 2 content types are being displayed in a View. The Nodes are published. Permissions are okay.
As an authenticated user I can see both content types (A & B) results.
As an anonymous user I can only see one content type (A).
Type A uses an entity reference relationship in the View.
Type B uses an autocomplete (unlimited) entity reference in the content type.
A number of exposed filters are being used. I removed them 1 by 1 and those aren't the issue.
I can't seem to track it down but Disable SQL rewriting @ Advanced:Other:Query settings is the only thing that allowed both to show for anonymous.
Additionally, the view still honors the filter, Content: Published (Yes)
Comment #5
superbole commentedHi Guys
I have basically the same problem. However there is one major difference, I'm not using "View Unpublished". However, Crutch's solution "solved" my problem too!
So I think this might be a Views issue and not a "View Unpublished" with Views issue.
Regards
Sheldon
Comment #6
adrianavaz commentedDisable SQL rewriting worked for me on 8.7. Thanks!
Comment #7
nixar commentedThank you #4 and #5, I was going nuts with a similar issue and it fixed it
Comment #8
muhammad.tanweer commented#4 works for me on drupal 7. Although when we disable query rewriting, it gives a warning but if you have your filters correctly, it shouldn't create a problem with resultset.
Comment #9
irinaz commented@crutch, thanks for writing up this solutions, it works on D8 as well. I still cannot figure out why this is happening when relationship is not required.
Thanks!
Comment #10
zebda commentedI'm having the same problem on drupal 8. I only have the problem on nodes where the field of the relationship is empty. So no relationship can be found.
By setting Disable SQL on, it overwrites all permissions. This is not a solid fix for me. Content is shown in the view that shouldn't be there. Since I'm using complex permissions its not possible to filter the view the right way.
Does anyone have a better fix for this?
Comment #11
beerendlauwers commentedSame issue here with a Drupal 9 site with the View Unpublished module.
EDIT: More info here: https://www.drupal.org/project/view_unpublished/issues/2390703