I’m developing a site using Drupal 8.2 and I have to create a page where the user can see which nodes he or she has viewed in the last 30 days. The goal is to provide a per user "browsing history" view with the recently read content ordered by date (ideally filtered by content type).
I’ve checked other similar questions about this topic and I’ve found the following suggested modules:
- Message module: Storing a per user history of interactions?
- Recently read module (and others): How to log the history of nodes viewed by a user, and report about them?
Unfortunately these modules don’t have Drupal 8 releases at the time of writing this question (except the Message module which has a pre-release/alpha version).
I’ve also reviewed the official docs and found there’s a core History module that tracks which nodes have been viewed by each user and when. I have this module enabled (it was enabled by default) and I’ve checked that it’s actually collecting user interactions in the history table. According to the docs:
In Drupal 8 and later, the History module is included in Drupal core. When enabled, the History module records which user has read which content.
This only applies to authenticated users. Entities older than 1 month will always be shown as "read".
There is no UI provided, but history data is exposed to the Views module. You can add history data as a field to show "new" or "updated" node marks. You can also use a filter to only show content that is new or updated.
this module provides some kind of interaction with Views, so I assume it should be posible to create a view to show a list with links to each node viewed by the user. I’ve reviewed all the options in Views (filters, contextual filters and so on) and haven’t found anything related to this history.
Is it really posible to create such a view? Any pointers on how to do that? Is there any other way to do this? How would you implement this funcionality in Drupal 8?
Cheers.