2

I want to show the list of unread nodes and read nodes. Actually, My scenario is to show the article listing page. The page contains the drop-down contains all, read and unread. The all list all the articles, In read, need to list the contents already read by the user and In unread, need to list the contents not-read by the user. For read, I did with recently-read module but that is not tracking the unread nodes. Hope somebody have already worked with this.

Thanks advance.

0

2 Answers 2

1

Using the Flag module seems like a no brainer to me to get this to work: introduce a flag that is used to flag relevant nodes as "read". To actually do so, just use the Rules module (using a Rules event like "When viewing content", a kind of getting started with Rules).

With the above in place, you've reduced your question to creating an appropriate view (using Views) which shows the node(s) for which their flagging status corresponds to "read", or "NOT read", or "all of them". If you want, you can created 3 tabs in your view to show these all / read / not read nodes.

Ps: I'm assuming this is about D7.

2
  • Thank you Pierre. Yes, i have tried with flag, but every time the user need to trigger the flag right. I don't want that. Let me try with rules now.
    – kalyani
    Apr 5, 2017 at 5:47
  • 1
    Yes. With the help of rules i completed the work. Thank yo so much
    – kalyani
    Apr 18, 2017 at 9:03
0

The following is a guide but you can continue to develop it In Drupal 8:

1) activate the statitics module.

2) Perform a query to the database for two tables

  • node_counter (statitics module)
  • node_field_data

    Query:

$query = \Drupal::database()->select('node_counter', 'nfd');
$query->addField('nfd', 'nid');
$query->join('node_field_data', 'ufd', 'ufd.nid = nfd.nid');
$query->addField('ufd', 'title');
$query->condition('ufd.type', 'article');
$result = $query->execute()->fetchAssoc('nid');

This query shows the nid and title of the articles that have been viewed.
To achieve that of the unseen I believe that a condition is needed

3
  • Thank you so much alberto... I have done with read list. Unread Listing is little tough for me.
    – kalyani
    Apr 4, 2017 at 16:09
  • To achieve that of the unseen I believe that a condition is needed, Compare both seen node id's list and all list of node id's and extract node id's which are not in common, those nid's will be your unseen node's
    – Ajay Reddy
    Apr 4, 2017 at 17:22
  • Yes i understand.. It will be user specific?
    – kalyani
    Apr 5, 2017 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.