create a Comments view type
add title and date (not sure its actually necessary),
then add a Comment: Node link (Display the standard comment link used on regular nodes.)
it should break the sql by adding a "type" field to the select query as outlined below, i dont see any "type" column in my sql comments table, should it be there?
SELECT comments.cid AS cid,
comments.subject AS comments_subject,
comments.nid AS comments_nid,
comments.timestamp AS comments_timestamp,
nid,
type,
comment
FROM dru_comments comments
LEFT JOIN dru_users users_comments ON comments.uid = users_comments.uid
WHERE users_comments.uid = 4
ORDER BY comments_timestamp DESC
if i run this against the database in mysql i get
ERROR 1054 (42S22): Unknown column 'type' in 'field list'
my view exported:
$view = new view;
$view->name = 'member_comments';
$view->description = 'Member comments.';
$view->tag = 'default';
$view->view_php = '';
$view->base_table = 'comments';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(
'uid' => array(
'id' => 'uid',
'table' => 'comments',
'field' => 'uid',
),
));
$handler->override_option('fields', array(
'subject' => array(
'label' => 'Title',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_comment' => 1,
'exclude' => 0,
'id' => 'subject',
'table' => 'comments',
'field' => 'subject',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'timestamp' => array(
'label' => 'Post date',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'date_format' => 'small',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'timestamp',
'table' => 'comments',
'field' => 'timestamp',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'node_link' => array(
'label' => 'Node link',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'teaser' => 0,
'exclude' => 0,
'id' => 'node_link',
'table' => 'comments',
'field' => 'node_link',
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'timestamp' => array(
'order' => 'DESC',
'granularity' => 'second',
'id' => 'timestamp',
'table' => 'comments',
'field' => 'timestamp',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'uid' => array(
'default_action' => 'not found',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'break_phrase' => 0,
'not' => 0,
'id' => 'uid',
'table' => 'users',
'field' => 'uid',
'relationship' => 'uid',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
'4' => 0,
'5' => 0,
'7' => 0,
'6' => 0,
'3' => 0,
'8' => 0,
),
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'flashnode' => 0,
'panel' => 0,
'group' => 0,
'group_post' => 0,
'page' => 0,
'profile' => 0,
'simplenews' => 0,
'story' => 0,
'uprofile' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'2' => 0,
'1' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_is_member' => 0,
'validate_argument_php' => '',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('title', 'My comments');
$handler->override_option('empty', 'No comments yet!');
$handler->override_option('empty_format', '1');
$handler->override_option('items_per_page', 5);
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 0,
'order' => 'asc',
'columns' => array(
'subject' => 'subject',
'node_link' => 'node_link',
'timestamp' => 'timestamp',
),
'info' => array(
'subject' => array(
'sortable' => 0,
'separator' => '',
),
'node_link' => array(
'separator' => '',
),
'timestamp' => array(
'sortable' => 0,
'separator' => '',
),
),
'default' => '-1',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'member-comments');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
i guess i can live without that field but..
Comments
Comment #1
sunConfirming.
Comment #2
esteewhy commentedSame problem.
Repro (almost repeating abaddon's):
10 Create View, based on Comments
20 Add "Comment: Node link" to fields
30 Execute "Preview"
The problem seems to be that "node_link" field handler doesn't fire, so [type] field is queried as if it was from a {comments} table, also no join is generated.
Comment #3
merlinofchaos commentedHm. Yeah, ok, this is surprising. That field is attached to the 'comment' table via comment_views_data() but it should be attached to the 'node' table via comment_views_data_alter.
Comment #4
merlinofchaos commentedDoes this patch fix it? (I did not test at all) -- note that the prior field will show as broken. You'll ahve to remove it and add the new field, which will now be properly listed as "Node: Comments link"
Comment #5
esteewhy commentedEarl, thanks for quick response !
Here's what I did:
10 Installed today's 6.x-2.x-dev
20 Applied changes manually (no cvs client at hand, sorry :[ ):
20.10 Removed 3X 'table' => 'node', from views_handler_field_comment_node_link.inc
20.20 Inserted $data['node']['comments_link'] ... at comments.views.inc
Here's what i've got:
10 Previously created view seems to work (!)
20 On editing [10] there's broken link message, as You said
30 On adding node link anew there's still 'Comment: Node link' caption
40 After adding filed [30] the same old error remains
Probably, I should inspect the patch file carefully once again (?)
UPD: my old view started working just because node_link isn't queried at all :(
Comment #6
merlinofchaos commentedYou may need to clear cache to get Views to refresh the hook_views_data()
Comment #7
esteewhy commentedAfter applying the patch to the today's -dev, I've tried flushing the following caches:
10 admin/settings/performance, [Clear cache data]
20 admin_menu/flush-cache/cache
30 admin_menu/flush-cache/requisites
Still the above symptoms remain ("column comments.type does not exist"), also the following still occurs:
10 On editing view's fields there only two field groups: 'Comment' and 'Global', no 'Node' as You've suggested
20 'Comment: Node link' field still present
I suspect somehow patched changes don't catch up due to some caching problems. Could You please suggest, how do I ensure that the cache was actually emptied ?
Comment #8
merlinofchaos commentedOk, the patch didn't remove "Comment: Node link" as it should have. Removed that, retested the new "Node: Add comment link" and that seems to be working properly.
Applied to 2.x and 3.x, but does not apply to 7.x-3.x. Marking for porting.
Comment #9
dawehnerHere is a version. I don't have time to test it.
The most problems where code style stuff, which got commited to 7.x
Comment #10
dawehnerI had redone this and tested it. Then it worked and i commited it.
Comment #12
kmontyI'm not certain this issue is 100% resolved. Unless you check the box "Show teaser-style link," this field does not appear to work. I've tried filling out the label field, rewriting the output of this field, outputting this field as a link, and even using the field as a replacement pattern on a Global: custom text field. Nada. I attempted to use 6.x-2.10 and 6.x-3.alpha3 with d6.16 with no luck.
Attached in my export.
Comment #13
merlinofchaos commentedCan you come up with a view that doesn't rely on other modules as an example? The nodequeue stuff is going to make it difficult to just import your view and see what you're seeing. Ideally just a simple node view on basic types from a stock install of Drupal will be a lot easier to investigate.
Comment #14
kmontyCertainly. See attached.
Comment #15
kmontyConfirming this bug is still present in 3.x-dev
Comment #16
summit commentedHi,
This error is also still in version 2.10.
Just to report you this bug.
"handler for node > comments_link doesn't exist!"
Thanks a lot in advance for working on this.
greetings, Martijn
Comment #17
dawehner#14
You are using it totally wrong. Comment link is not a url it's a link with a href etc.
So you cannot use global: custom and use comment_add in the link field.
#16 you might clear the cache and it will work.
Comment #18
kmontyDereine, I got no output from using the field. Cna you use my views_export and confirm the issue before closing?
if I am using it wrong, please tell me how to use it.
Comment #19
dawehnerI used your views export. And as i said you did it wrong.
The /* Field: Node: Add comment link */
field worked fine here.
The /* Field: Global: Custom text */ cannot work because of
while comments_link is a link and not a path.
Comment #21
Letharion commented