Hi. I need to use a list view that shows both the author of the node and the author of the newest comment. This view works similarly to the Forum Module but not quite. This view seems (to me) to be correctly configured but when someone comments on any of the nodes displayed the Node: Author Name field and the Comment: Last Comment Author field both display the comment author.
I'm not much of a coder so it would be absolutely wonderful if someone could help me out on this.
Here's the view:
$view = new stdClass();
$view->name = 'Umraeda_Adstod';
$view->description = '';
$view->access = array (
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = '';
$view->page_header = '<div class="Umraedur-Listi-Link"><h2><a href="/umraeda">Umræða:</a> Aðstoð</h2></div><div class="Umraedur-Listi-Lysing">Vantar þig aðstoð? Fáðu svör við tæknilegum, fagurfræðilegum eða einfaldlega fræðilegum spurningum hér.</div><div class="Umraedur-Listi-Nyr-Thradur"><a href="/node/add/umraeduthradur">Nýr þráður</a></div><div class="Umraedur-Listi-Haus"><div class="Haus-Svor">Svör</div><div class="Haus-Hofundur">Höfundur</div><div class="Haus-Svarad">Nýjasta innlegg</div><div class="Haus-Clear-Both"></div></div>';
$view->page_header_format = '3';
$view->page_footer = '<div class="Umraeda-Listi-Botnlina"></div>';
$view->page_footer_format = '3';
$view->page_empty = '';
$view->page_empty_format = '3';
$view->page_type = 'list';
$view->url = 'umraeda/adstod';
$view->use_pager = TRUE;
$view->nodes_per_page = '7';
$view->sort = array (
array (
'tablename' => 'node_comment_statistics',
'field' => 'last_comment_timestamp',
'sortorder' => 'DESC',
'options' => 'normal',
),
array (
'tablename' => 'node',
'field' => 'created',
'sortorder' => 'DESC',
'options' => 'normal',
),
);
$view->argument = array (
);
$view->field = array (
array (
'tablename' => 'node',
'field' => 'title',
'label' => '',
'handler' => 'views_handler_field_nodelink',
'options' => 'link',
),
array (
'tablename' => 'node_comment_statistics',
'field' => 'last_comment_timestamp',
'label' => '',
'handler' => 'views_handler_field_date_custom',
'options' => 'j. F Y',
),
array (
'tablename' => 'node',
'field' => 'created',
'label' => '',
'handler' => 'views_handler_field_date_custom',
'options' => 'j. F Y',
),
array (
'tablename' => 'node_comment_statistics',
'field' => 'comment_count',
'label' => '',
'handler' => 'views_handler_field_int',
),
array (
'tablename' => 'node_comment_statistics',
'field' => 'last_comment_name',
'label' => '',
),
array (
'tablename' => 'users',
'field' => 'name',
'label' => '',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'type',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => 'umraeduthradur',
),
),
array (
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
array (
'tablename' => 'term_node_4',
'field' => 'tid',
'operator' => 'AND',
'options' => '',
'value' => array (
0 => '13',
),
),
);
$view->exposed_filter = array (
);
$view->requires = array(node_comment_statistics, node, users, term_node_4);
$views[$view->name] = $view;
Comments
Comment #1
sunThis is probably caused by both node and comment using the same field name "name" for the author name, overwriting themselves in an arbitrary order.
The bad news is that we probably cannot fix this without breaking thousands of Drupal sites.
Consider upgrading to 6.x, please.