Show new content count on the taxonomy term list view I have a view that lists the terms in a specific vocabulary. I can also mark the terms if there is a new content tagged with this term. My view looks like this:


  
  Term 1
  Term 2
  Term 3 (new)
  Term 4
  Term 5 (new)
  ...
  


However, what I would like to achieve is a view that shows the count of the new contents tagged with a term. Like this:


  
  Term 1
  Term 2
  Term 3 (2 new)
  Term 4
  Term 5 (7 new)
  


My current views configuration is like following:


Showing taxonomy terms of a specific vocabulary
Added a relationship of Taxonomy term: Content using my vocabulary
Added field Content: Has new content: This has caused duplicate rows for the terms that has more than one new content. For example, if a term has three new contents, it was listed three times. So I did the next step.
Activated Aggregation, and set the aggregations settings of the field Content: Has new content to SUM: This has solved the duplicate rows issue, but it doesn't show the sum of the contents as I actually wanted to achieve.


Is there any possibility that I can show the number of new contents on this view?
Solution A: Use Views Field View

Using the Views Field View module it is possible to embed the results of one view into another view.

First create a view for nodes without a page/block (you only need the master display) and name it New content count by term. Add a context filter Content: Has taxonomy term ID. Ensure that only the Nid is listed in the fields section, add the filters Content: Published (Yes) and Content: Has new content, then enable aggregation, choose Count from the Aggregation settings of the Nid field and finally remove any pagers.



Now you may embed the New content count by term view into your principal view (taxonomy terms) by adding a "Global: View"-field (provided by the Views Field View module). In order to specify the tid-parameter of the embedded view, make sure that the Term id is also exposed as a field in the principal view. If you do not want to show it to the end user, just choose Exclude from display in the field settings. After the output of the tid field can be used as a parameter (token [tid]) for the embedded view.

Solution B: Use hook_views_query_alter

There is a function in the forum module responsible of returning the number of new posts on a topic (term) on behalf of a given user (_forum_topics_unread). Use this query as a starting point for your own implementation of hook_views_query_alter.

I recommend to go for solution A and only try to implement B when performance is degraded beyond acceptable limits.