Using the following view, there are no comments being set in the data, however the view is being passed thru the correct handler, $data->comments_comment, is always null even tho $data->nid is an integer, when i look up that node in the comment table i can see there are no comments associated
mysql> select count(*) from comments where nid=1500;
+----------+
| count(*) |
+----------+
| 0 |
+----------+
1 row in set (0.03 sec)
This is being called 5 times, $data->nid is set but there are no comments
function views_handler_field_comment($fieldinfo, $fielddata, $value, $data) {
$obj = new stdClass();
$obj->comment = check_markup($data->comments_comment, $data->comments_format, FALSE);
comment_invoke_comment($obj, 'view');
return $obj->comment;
}
Here is my view, am i doing something wrong? I'm trying to get the most recent comments that have made (show the comment text not the node title)
$view = new stdClass();
$view->name = 'fieldtest';
$view->description = '';
$view->access = array (
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = 'rcent comments';
$view->page_header = '';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = '';
$view->page_empty_format = '1';
$view->page_type = 'list';
$view->url = 'comment-test';
$view->use_pager = TRUE;
$view->nodes_per_page = '5';
$view->sort = array (
array (
'tablename' => 'comments',
'field' => 'timestamp',
'sortorder' => 'DESC',
'options' => 'normal',
),
);
$view->argument = array (
);
$view->field = array (
array (
'tablename' => 'comments',
'field' => 'comment',
'label' => 'Comment',
),
);
$view->filter = array (
array (
'tablename' => 'node_comment_statistics',
'field' => 'comment_count',
'operator' => '>',
'options' => '',
'value' => '0',
),
);
$view->exposed_filter = array (
);
$view->requires = array(comments, node_comment_statistics);
$views[$view->name] = $view;
Comments
Comment #1
dgtlmoon commentedAhh interesting, if i specify the comment: cid as a field it seems to work
Comment #2
discursives commentedI am gettingmassive sql and php errors when tryin gto query for comment content. Can you confirm that this actually worked for you? The content I want is displayed, yes, but its only after 1.5 pages of sql errors.
# user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE in /home/.asha/dpacket/drupal/html/includes/database.mysql.inc on line 172.
# warning: Invalid argument supplied for foreach() in /home/.asha/dpacket/drupal/html/modules/node/node.module on line 504.
# warning: implode() [function.implode]: Bad arguments. in /home/.asha/dpacket/drupal/html/modules/node/node.module on line 508.
# user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE in /home/.asha/dpacket/drupal/html/includes/database.mysql.inc on line 172.
Comment #3
yoroy commentedClosing, this version of views is not supported anymore.