Score:0

Updated/commented date - display permission problem

in flag

I'm trying to get a Comment Statistics (category) - Updated/commented date field {{ last_updated }} which is a date formatted field to be visible to everyone including anonymous users.

The view access is set to Permission | View published content. Every field in the view (except for this field) is visible to anonymous users. If a user logs in (the role does not matter) the field information is displayed.

I've tried everything I can think of.

  • Installing the views_field_permissions module, setting the permission for that field to role based, and checking all roles including anonymous using the 'or' operator.
  • Setting the access to role based with every role including anonymous selected
  • Disabling SQL rewriting in the views query settings
  • Checking all the related permissions for comments
  • Using a global custom text field with some Twig to set my own variable to the last_updated field and printing the variable as the fields output {% set show_last = last_updated %} {{ show_last }} (same thing logged in shows, logged out does not)

Nothing! For whatever reason nothing seems to make that specific field type visible unless logged in and I have no idea why. I have another field from the Comment Statistics (category) "Comment Count" field and that one displays fine like all other fields, just not the Comment Statistics "Updated/commented date" field {{ last_updated }}.

Is this field special in a way it cannot be made visible to a user that isn't logged in?

In the case this matters, I am using Drupal 9.5.9 and PHP 8.1.13.

Edit: adding images that show the problem as displayed by web browser, also includes view and field settings. View display logged in Not logged in View Display

unusedspoon avatar
aq flag
Have you looked in your theme to see if that's altering it? e.g. in a twig template or css hiding it? Or possibly the theme/custom module altering the views output?
sidgrafix avatar
in flag
Those were of the very first things I checked (guess I should have mentioned it prior)! Default template for core/views: views-view-field.html.twig is in use and when not logged in the the field row for the field in question doesn't exist when searching elements with browser console so nothing like css hiding it or js removing it. But as soon as any user logs in bam it's there doesn't matter if just an authenticated user or user with a role. Just doubled checked and nothing in custom theme or module is altering the view or its fields.
sidgrafix avatar
in flag
Just found another field doing the same thing [Content: Has new content field] which is a marker that displays the word "updated" `<span class="marker">Updated</span>` and is supposed to display when there has been an update to the content in question by edit or a new comment added per the view field settings. Like the other field I can't get to display to anonymous users this one won't either (but if logged in it displays
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.