I have comments on nodes that are categorised by terms. I need to show a view of the terms and if there are any new comments in any of the nodes that term is tagged with.
So if I have the following:
Term1
-NodeA (has new comments)
-NodeB (has new comments)
Term2
-NodeC (no new comments)
-NodeD (no new comments)
Term3
-NodeE (no new comments)
-NodeF (has new comments)
Term4
I need my view to look like this:
Term1 – new comments!
Term2
Term3 – new comments!
Term4
First I tried making a view of comments to include the new comments field and using relationships to show the terms. However if a term has no nodes or comments (Term4 in my example) I need the term to still be displayed.
So I then tried making a view of the terms. I added the relationships 'Taxonomy term: Content with term' and the field 'Content: New comments' which uses this relationship. This does show the number of new comments as expected. It gives me duplicated results (which I may be able to fix with grouping fields) but unexpectedly it also hides the terms that have no comments or nodes.
Am I going about this the right way and if so how can I stop the 'empty' terms being hidden?
UPDATE Ive updated D core and a few modules that had new versions (but not views). The view works fine with the relationship of 'Configure Relationship: Taxonomy term: Content with term' when the field is 'Content: Title (Title)'. However when I add the field 'Content: New comments' then terms that have no comments are hidden.
UPDATE Ive tried the following in a views field:
if(intval($data->node_new_comments) > 0) {
if(!array_key_exists($data->tid, $static)) {
print "new comments !";
$static[$data->tid] = 1;
}
} else {
print "here you do whatever you want when there's no new comment";
}
UPDATE - by 'new comments' I mean comments that the logged in user hasnt read. This is a standard field in views. I need this rather than an arbitrary date cut off. Sorry for any confusion.
Taxonomy term: Term name
and notContent: -term vocabulary-
(easy mistake to make!) 4) Do you see the same thing if you create a new Taxonomy Terms view from scratch with only the relationship,Taxonomy Term: Term Name
andContent: New Comments
? – user56reinstatemonica8 Jan 2 '13 at 0:27