View does not show content if field from relationship are empty

Created on 19 May 2023, over 1 year ago
Updated 12 June 2023, over 1 year ago

I have a view with a relationship that is not required. This view has been working fine for a while, but recently we noticed that for anonymous users a lot of content was not being displayed by the view. In our case it should display about 30 rows, but instead it only shows 5. The only workaround seems to be to enabled "Disable SQL rewriting" which is rather unintuitive and raises other issues.

It seems though that when I enable "require this relationship" the output of the view for admin users is the same limited output that anonymous users are seeing. These 5 items that it shows all do not have the relationship field. So essentially it seems like anonymous users are seeing the output of "require this relationship" even without that being enabled.

Upon searching for this bug the only thing I could find was this comment on stack exchange which seems to describe the problem exactly:
https://drupal.stackexchange.com/questions/216757/views-does-not-show-co...

I don't think this problem occurred with our upgrade to Drupal 9, but sometime over the past 6 months or so.

πŸ› Bug report
Status

Closed: duplicate

Version

9.5

Component
ViewsΒ  β†’

Last updated about 1 hour ago

Created by

πŸ‡ΊπŸ‡ΈUnited States srdtwc Skokie, IL

Live updates comments and jobs are added and updated live.
  • views

    Involves, uses, or integrates with views. In Drupal 8 core, use the β€œVDC” tag instead.

Sign in to follow issues

Comments & Activities

  • Issue created by @srdtwc
  • πŸ‡ΊπŸ‡ΈUnited States srdtwc Skokie, IL

    Screenshot:

    Here is the config of the view

    uuid: 8d3c967d-3289-4f59-891a-8d072342ebbc
    langcode: en
    status: true
    dependencies:
      config:
        - field.storage.node.field_date_range
        - field.storage.node.field_location
        - field.storage.node.field_teaser_text
        - node.type.event
        - taxonomy.vocabulary.event_type
      module:
        - address
        - better_exposed_filters
        - date_range_formatter
        - datetime
        - neym_custom
        - node
        - taxonomy
        - text
        - user
    id: event_calendar_list
    label: 'Event Calendar List'
    module: views
    description: ''
    tag: ''
    base_table: node_field_data
    base_field: nid
    display:
      default:
        id: default
        display_title: Master
        display_plugin: default
        position: 0
        display_options:
          title: 'Filter By:'
          fields:
            title:
              id: title
              table: node_field_data
              field: title
              relationship: none
              group_type: group
              admin_label: ''
              entity_type: node
              entity_field: title
              plugin_id: field
              label: ''
              exclude: false
              alter:
                alter_text: false
                text: ''
                make_link: false
                path: ''
                absolute: false
                external: false
                replace_spaces: false
                path_case: none
                trim_whitespace: false
                alt: ''
                rel: ''
                link_class: ''
                prefix: ''
                suffix: ''
                target: ''
                nl2br: false
                max_length: 0
                word_boundary: true
                ellipsis: true
                more_link: false
                more_link_text: ''
                more_link_path: ''
                strip_tags: false
                trim: false
                preserve_tags: ''
                html: false
              element_type: h4
              element_class: ''
              element_label_type: ''
              element_label_class: ''
              element_label_colon: false
              element_wrapper_type: ''
              element_wrapper_class: ''
              element_default_classes: true
              empty: ''
              hide_empty: false
              empty_zero: false
              hide_alter_empty: true
              click_sort_column: value
              type: string
              settings:
                link_to_entity: true
              group_column: value
              group_columns: {  }
              group_rows: true
              delta_limit: 0
              delta_offset: 0
              delta_reversed: false
              delta_first_last: false
              multi_type: separator
              separator: ', '
              field_api_classes: false
            field_date_range_1:
              id: field_date_range_1
              table: node__field_date_range
              field: field_date_range
              relationship: none
              group_type: group
              admin_label: 'Monthly Section Header'
              plugin_id: field
              label: ''
              exclude: true
              alter:
                alter_text: false
                text: ''
                make_link: false
                path: ''
                absolute: false
                external: false
                replace_spaces: false
                path_case: none
                trim_whitespace: false
                alt: ''
                rel: ''
                link_class: ''
                prefix: ''
                suffix: ''
                target: ''
                nl2br: false
                max_length: 0
                word_boundary: true
                ellipsis: true
                more_link: false
                more_link_text: ''
                more_link_path: ''
                strip_tags: false
                trim: false
                preserve_tags: ''
                html: false
              element_type: ''
              element_class: ''
              element_label_type: ''
              element_label_class: ''
              element_label_colon: false
              element_wrapper_type: ''
              element_wrapper_class: ''
              element_default_classes: true
              empty: ''
              hide_empty: false
              empty_zero: false
              hide_alter_empty: true
              click_sort_column: value
              type: date_range_without_time
              settings:
                timezone_override: ''
                one_day: 'F Y'
                one_month: 'F Y'
                several_months: 'F Y'
                several_years: 'F Y'
                single: 'F Y'
                single_all_day: 'F Y'
              group_column: value
              group_columns: {  }
              group_rows: false
              delta_limit: 0
              delta_offset: 0
              delta_reversed: false
              delta_first_last: false
              multi_type: separator
              separator: ', '
              field_api_classes: false
            field_location:
              id: field_location
              table: node__field_location
              field: field_location
              relationship: none
              group_type: group
              admin_label: ''
              plugin_id: field
              label: ''
              exclude: true
              alter:
                alter_text: true
                text: '<div class="views-field-field-location">{{ field_location }}</div>'
                make_link: false
                path: ''
                absolute: false
                external: false
                replace_spaces: false
                path_case: none
                trim_whitespace: false
                alt: ''
                rel: ''
                link_class: ''
                prefix: ''
                suffix: ''
                target: ''
                nl2br: false
                max_length: 0
                word_boundary: true
                ellipsis: true
                more_link: false
                more_link_text: ''
                more_link_path: ''
                strip_tags: false
                trim: false
                preserve_tags: ''
                html: false
              element_type: ''
              element_class: ''
              element_label_type: ''
              element_label_class: ''
              element_label_colon: false
              element_wrapper_type: ''
              element_wrapper_class: ''
              element_default_classes: true
              empty: ''
              hide_empty: true
              empty_zero: true
              hide_alter_empty: true
              click_sort_column: langcode
              type: City_state
              settings: {  }
              group_column: ''
              group_columns: {  }
              group_rows: true
              delta_limit: 0
              delta_offset: 0
              delta_reversed: false
              delta_first_last: false
              multi_type: separator
              separator: ', '
              field_api_classes: false
            field_location_1:
              id: field_location_1
              table: node__field_location
              field: field_location
              relationship: field_meetinghouse_location
              group_type: group
              admin_label: ''
              plugin_id: field
              label: ''
              exclude: true
              alter:
                alter_text: true
                text: '<div class="views-field-field-location">{{ field_location_1 }}</div>'
                make_link: false
                path: ''
                absolute: false
                external: false
                replace_spaces: false
                path_case: none
                trim_whitespace: false
                alt: ''
                rel: ''
                link_class: ''
                prefix: ''
                suffix: ''
                target: ''
                nl2br: false
                max_length: 0
                word_boundary: true
                ellipsis: true
                more_link: false
                more_link_text: ''
                more_link_path: ''
                strip_tags: false
                trim: false
                preserve_tags: ''
                html: false
              element_type: ''
              element_class: ''
              element_label_type: ''
              element_label_class: ''
              element_label_colon: false
              element_wrapper_type: ''
              element_wrapper_class: ''
              element_default_classes: true
              empty: '{{ field_location }}'
              hide_empty: true
              empty_zero: true
              hide_alter_empty: true
              click_sort_column: langcode
              type: City_state
              settings: {  }
              group_column: ''
              group_columns: {  }
              group_rows: true
              delta_limit: 0
              delta_offset: 0
              delta_reversed: false
              delta_first_last: false
              multi_type: separator
              separator: ', '
              field_api_classes: false
            field_location_administrative_area:
              id: field_location_administrative_area
              table: node__field_location
              field: field_location_administrative_area
              relationship: field_meetinghouse_location
              group_type: group
              admin_label: 'Search Filter: Quaker Meeting State'
              plugin_id: subdivision
              label: ''
              exclude: true
              alter:
                alter_text: false
                text: ''
                make_link: false
                path: ''
                absolute: false
                external: false
                replace_spaces: false
                path_case: none
                trim_whitespace: false
                alt: ''
                rel: ''
                link_class: ''
                prefix: ''
                suffix: ''
                target: ''
                nl2br: false
                max_length: 0
                word_boundary: true
                ellipsis: true
                more_link: false
                more_link_text: ''
                more_link_path: ''
                strip_tags: false
                trim: false
                preserve_tags: ''
                html: false
              element_type: ''
              element_class: ''
              element_label_type: ''
              element_label_class: ''
              element_label_colon: false
              element_wrapper_type: ''
              element_wrapper_class: ''
              element_default_classes: true
              empty: ''
              hide_empty: false
              empty_zero: false
              hide_alter_empty: true
              display_name: false
            field_location_administrative_area_1:
              id: field_location_administrative_area_1
              table: node__field_location
              field: field_location_administrative_area
              relationship: none
              group_type: group
              admin_label: 'Search Filter: Other Location State'
              plugin_id: subdivision
              label: ''
              exclude: true
              alter:
                alter_text: false
                text: ''
                make_link: false
                path: ''
                absolute: false
                external: false
                replace_spaces: false
                path_case: none
                trim_whitespace: false
                alt: ''
                rel: ''
                link_class: ''
                prefix: ''
                suffix: ''
                target: ''
                nl2br: false
                max_length: 0
                word_boundary: true
                ellipsis: true
                more_link: false
                more_link_text: ''
                more_link_path: ''
                strip_tags: false
                trim: false
                preserve_tags: ''
                html: false
              element_type: ''
              element_class: ''
              element_label_type: ''
              element_label_class: ''
              element_label_colon: false
              element_wrapper_type: ''
              element_wrapper_class: ''
              element_default_classes: true
              empty: ''
              hide_empty: false
              empty_zero: false
              hide_alter_empty: true
              display_name: false
            field_date_range:
              id: field_date_range
              table: node__field_date_range
              field: field_date_range
              relationship: none
              group_type: group
              admin_label: ''
              plugin_id: field
              label: ''
              exclude: false
              alter:
                alter_text: true
                text: '{{ field_date_range }}{{ field_location_1 }}'
                make_link: false
                path: ''
                absolute: false
                external: false
                replace_spaces: false
                path_case: none
                trim_whitespace: false
                alt: ''
                rel: ''
                link_class: ''
                prefix: ''
                suffix: ''
                target: ''
                nl2br: false
                max_length: 0
                word_boundary: true
                ellipsis: true
                more_link: false
                more_link_text: ''
                more_link_path: ''
                strip_tags: true
                trim: false
                preserve_tags: ''
                html: false
              element_type: ''
              element_class: ''
              element_label_type: ''
              element_label_class: ''
              element_label_colon: false
              element_wrapper_type: ''
              element_wrapper_class: ''
              element_default_classes: true
              empty: ''
              hide_empty: false
              empty_zero: false
              hide_alter_empty: true
              click_sort_column: value
              type: date_range_without_time
              settings:
                timezone_override: ''
                one_day: 'F j'
                one_month: 'F j-{j}'
                several_months: 'F j-{F} {j}'
                several_years: 'F j-{F} {j}'
                single: 'F j'
                single_all_day: 'F j'
              group_column: value
              group_columns: {  }
              group_rows: true
              delta_limit: 0
              delta_offset: 0
              delta_reversed: false
              delta_first_last: false
              multi_type: separator
              separator: '&nbsp; | &nbsp;'
              field_api_classes: false
            field_teaser_text:
              id: field_teaser_text
              table: node__field_teaser_text
              field: field_teaser_text
              relationship: none
              group_type: group
              admin_label: ''
              plugin_id: field
              label: ''
              exclude: false
              alter:
                alter_text: false
                text: ''
                make_link: false
                path: ''
                absolute: false
                external: false
                replace_spaces: false
                path_case: none
                trim_whitespace: false
                alt: ''
                rel: ''
                link_class: ''
                prefix: ''
                suffix: ''
                target: ''
                nl2br: false
                max_length: 0
                word_boundary: true
                ellipsis: true
                more_link: false
                more_link_text: ''
                more_link_path: ''
                strip_tags: false
                trim: false
                preserve_tags: ''
                html: false
              element_type: ''
              element_class: ''
              element_label_type: ''
              element_label_class: ''
              element_label_colon: false
              element_wrapper_type: ''
              element_wrapper_class: ''
              element_default_classes: true
              empty: ''
              hide_empty: false
              empty_zero: false
              hide_alter_empty: true
              click_sort_column: value
              type: text_default
              settings: {  }
              group_column: value
              group_columns: {  }
              group_rows: true
              delta_limit: 0
              delta_offset: 0
              delta_reversed: false
              delta_first_last: false
              multi_type: separator
              separator: ', '
              field_api_classes: false
          pager:
            type: full
            options:
              offset: 0
              items_per_page: 15
              total_pages: null
              id: 0
              tags:
                next: Next
                previous: Prev
                first: ''
                last: ''
              expose:
                items_per_page: false
                items_per_page_label: 'Items per page'
                items_per_page_options: '5, 10, 25, 50'
                items_per_page_options_all: false
                items_per_page_options_all_label: '- All -'
                offset: false
                offset_label: Offset
              quantity: 9
          exposed_form:
            type: bef
            options:
              submit_button: Apply
              reset_button: false
              reset_button_label: Reset
              exposed_sorts_label: 'Sort by'
              expose_sort_order: true
              sort_asc_label: Asc
              sort_desc_label: Desc
              input_required: false
              text_input_required: 'Select any filter and click on Apply to see results'
              text_input_required_format: plain_text
              bef:
                general:
                  autosubmit: true
                  autosubmit_exclude_textfield: false
                  autosubmit_hide: true
                  input_required: false
                  allow_secondary: false
                  secondary_label: 'Advanced options'
                  text_input_required: 'Select any filter and click on Apply to see results'
                  text_input_required_format: basic_html
                filter:
                  combine:
                    plugin_id: default
                    advanced:
                      sort_options: false
                      placeholder_text: ''
                      rewrite:
                        filter_rewrite_values: ''
                      collapsible: false
                      is_secondary: false
                  field_event_type_target_id:
                    plugin_id: default
                    advanced:
                      sort_options: false
                      placeholder_text: ''
                      rewrite:
                        filter_rewrite_values: ''
                      collapsible: false
                      is_secondary: false
          access:
            type: perm
            options:
              perm: 'access content'
          cache:
            type: tag
            options: {  }
          empty:
            area:
              id: area
              table: views
              field: area
              relationship: none
              group_type: group
              admin_label: ''
              plugin_id: text
              empty: true
              content:
                value: 'Sorry, no events matching your criteria were found.'
                format: plain_text
              tokenize: false
          sorts:
            field_date_range_value:
              id: field_date_range_value
              table: node__field_date_range
              field: field_date_range_value
              relationship: none
              group_type: group
              admin_label: ''
              plugin_id: datetime
              order: ASC
              expose:
                label: ''
                field_identifier: field_date_range_value
              exposed: false
              granularity: day
            created:
              id: created
              table: node_field_data
              field: created
              relationship: none
              group_type: group
              admin_label: ''
              entity_type: node
              entity_field: created
              plugin_id: date
              order: DESC
              expose:
                label: ''
                field_identifier: created
              exposed: false
              granularity: second
          arguments: {  }
          filters:
            status:
              id: status
              table: node_field_data
              field: status
              entity_type: node
              entity_field: status
              plugin_id: boolean
              value: '1'
              group: 1
              expose:
                operator: ''
                operator_limit_selection: false
                operator_list: {  }
            type:
              id: type
              table: node_field_data
              field: type
              entity_type: node
              entity_field: type
              plugin_id: bundle
              value:
                event: event
              group: 1
              expose:
                operator_limit_selection: false
                operator_list: {  }
            combine:
              id: combine
              table: views
              field: combine
              relationship: none
              group_type: group
              admin_label: ''
              plugin_id: combine
              operator: '='
              value: ''
              group: 1
              exposed: true
              expose:
                operator_id: combine_op
                label: 'Combine fields filter'
                description: null
                use_operator: false
                operator: combine_op
                operator_limit_selection: false
                operator_list: {  }
                identifier: combine
                required: false
                remember: false
                multiple: false
                remember_roles:
                  authenticated: authenticated
                placeholder: null
              is_grouped: true
              group_info:
                label: 'Location:'
                description: ''
                identifier: combine
                optional: true
                widget: select
                multiple: false
                remember: false
                default_group: All
                default_group_multiple: {  }
                group_items:
                  1:
                    title: Connecticut
                    operator: word
                    value: CT
                  2:
                    title: Maine
                    operator: word
                    value: ME
                  3:
                    title: Massachusetts
                    operator: word
                    value: MA
                  4:
                    title: 'New Hampshire'
                    operator: word
                    value: NH
                  5:
                    title: 'Rhode Island'
                    operator: word
                    value: RI
                  6:
                    title: Vermont
                    operator: word
                    value: VT
                  7:
                    title: 'Outside New England'
                    operator: regular_expression
                    value: '\b(?:(?!CT|MA|ME|NH|RI|VT)\w)+\b'
              fields:
                field_location_administrative_area: field_location_administrative_area
                field_location_administrative_area_1: field_location_administrative_area_1
            field_event_type_target_id:
              id: field_event_type_target_id
              table: node__field_event_type
              field: field_event_type_target_id
              relationship: none
              group_type: group
              admin_label: ''
              plugin_id: taxonomy_index_tid
              operator: or
              value: {  }
              group: 1
              exposed: true
              expose:
                operator_id: field_event_type_target_id_op
                label: 'Event type:'
                description: ''
                use_operator: false
                operator: field_event_type_target_id_op
                operator_limit_selection: false
                operator_list: {  }
                identifier: field_event_type_target_id
                required: false
                remember: false
                multiple: false
                remember_roles:
                  authenticated: authenticated
                  anonymous: '0'
                  editor: '0'
                  super_user: '0'
                  administrator: '0'
                reduce: false
              is_grouped: false
              group_info:
                label: ''
                description: ''
                identifier: ''
                optional: true
                widget: select
                multiple: false
                remember: false
                default_group: All
                default_group_multiple: {  }
                group_items: {  }
              reduce_duplicates: false
              vid: event_type
              type: select
              hierarchy: false
              limit: true
              error_message: true
            field_date_range_end_value:
              id: field_date_range_end_value
              table: node__field_date_range
              field: field_date_range_end_value
              relationship: none
              group_type: group
              admin_label: ''
              plugin_id: datetime
              operator: '>='
              value:
                min: ''
                max: ''
                value: TODAY
                type: offset
              group: 2
              exposed: false
              expose:
                operator_id: ''
                label: ''
                description: ''
                use_operator: false
                operator: ''
                operator_limit_selection: false
                operator_list: {  }
                identifier: ''
                required: false
                remember: false
                multiple: false
                remember_roles:
                  authenticated: authenticated
                min_placeholder: ''
                max_placeholder: ''
                placeholder: ''
              is_grouped: false
              group_info:
                label: ''
                description: ''
                identifier: ''
                optional: true
                widget: select
                multiple: false
                remember: false
                default_group: All
                default_group_multiple: {  }
                group_items: {  }
            field_date_range_end_value_1:
              id: field_date_range_end_value_1
              table: node__field_date_range
              field: field_date_range_end_value
              relationship: none
              group_type: group
              admin_label: ''
              plugin_id: datetime
              operator: empty
              value:
                min: ''
                max: ''
                value: ''
                type: date
              group: 2
              exposed: false
              expose:
                operator_id: ''
                label: ''
                description: ''
                use_operator: false
                operator: ''
                operator_limit_selection: false
                operator_list: {  }
                identifier: ''
                required: false
                remember: false
                multiple: false
                remember_roles:
                  authenticated: authenticated
                min_placeholder: ''
                max_placeholder: ''
                placeholder: ''
              is_grouped: false
              group_info:
                label: ''
                description: ''
                identifier: ''
                optional: true
                widget: select
                multiple: false
                remember: false
                default_group: All
                default_group_multiple: {  }
                group_items: {  }
          filter_groups:
            operator: AND
            groups:
              1: AND
              2: OR
          style:
            type: default
            options:
              grouping:
                -
                  field: field_date_range_1
                  rendered: true
                  rendered_strip: true
              row_class: ''
              default_row_class: true
          row:
            type: fields
            options:
              default_field_elements: true
              inline: {  }
              separator: ''
              hide_empty: true
          query:
            type: views_query
            options:
              query_comment: ''
              disable_sql_rewrite: false
              distinct: true
              replica: false
              query_tags: {  }
          relationships:
            field_meetinghouse_location:
              id: field_meetinghouse_location
              table: node__field_meetinghouse_location
              field: field_meetinghouse_location
              relationship: none
              group_type: group
              admin_label: 'field_meetinghouse_location: Content'
              plugin_id: standard
              required: false
          use_ajax: true
          header: {  }
          footer: {  }
          display_extenders: {  }
        cache_metadata:
          max-age: -1
          contexts:
            - 'languages:language_content'
            - 'languages:language_interface'
            - url
            - url.query_args
            - user
            - 'user.node_grants:view'
            - user.permissions
          tags:
            - 'config:field.storage.node.field_date_range'
            - 'config:field.storage.node.field_location'
            - 'config:field.storage.node.field_teaser_text'
      block_1:
        id: block_1
        display_title: Block
        display_plugin: block
        position: 1
        display_options:
          display_extenders: {  }
        cache_metadata:
          max-age: -1
          contexts:
            - 'languages:language_content'
            - 'languages:language_interface'
            - url
            - url.query_args
            - user
            - 'user.node_grants:view'
            - user.permissions
          tags:
            - 'config:field.storage.node.field_date_range'
            - 'config:field.storage.node.field_location'
            - 'config:field.storage.node.field_teaser_text'
    
    
  • Status changed to Closed: duplicate over 1 year ago
  • πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

    This sounds like an instance of πŸ› node_access filters out accessible nodes when node is left joined Needs work , please try the patches there and see if it helps. If you feel this is a different issue, feel free to re-open this.

Production build 0.71.5 2024