Hi,

I am thinking if it is possible to use views to list out only a 1 latest comment from each node type.

Currently, what it seems to be doing is only to list only the X latest comments a node type.

Thanks.

Comments

CobraMP’s picture

I was looking for this. Currently my view will show duplicate rows due to multiple comments. Another resolution would be a way to merge the comments into one field.

dawehner’s picture

did you tryed out http://drupal.org/project/views_groupby

this enables group by contentyp, it could be a solution, but i'm not sure at the moment

merlinofchaos’s picture

Status:Active» Closed (won't fix)

This is almost impossible to do in just one query, and as such is something Views can't support.

scalp’s picture

Sorry to bring an old thread to life, but it's the closest I've found to addressing my issue. Does anyone know if it would be possible to address this issue by limiting the way Drupal core outputs those comments? It seems as though when a row style of node is selected Views will pull in the comments of that node, but it's still using Drupal core's handling of those comments. So couldn't we somehow just limit the Comment module? I realize that this isn't a Views issue at this point, but just trying to figure out a solution.

scalp’s picture

Here's what I came up with:

function yourmodule_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'node_type_form'){
$form['comment']['comment_default_per_page']['#options'] = array('1' => t('1), '10' => t('10'));
}
}

This will allow you to select 1 or 10 from the drop down in the content type edit page to determine how many comments should show on a page. As long as you're not showing comments using the default comment display elsewhere this will only show 1 or 10 comments under each node in a view if you're using row style "node". I use Views and Panels to display comments elsewhere so this works for me.