I have a View which returns a list of nodes (custom content type) and I've added a Content: Add comment link field below each listing. Desired behaviour is for a user to see the list of nodes with a button to add a comment below each node, clicking the button links to a page with only that node, all its comments, but the link lands on the comment form (the link should be localhost/site_dir/node/[nid]#comment-form).

However, the view only shows the Add Comment Link for nodes which already have comments! I need the link to show on all nodes. I've tried a) checking that content permissions for comments are correct, b) making sure that comments are open for that content type, c) making sure the comment field isn't hidden for that content type. I don't know what else to try!

I would try rewriting the output on a Content: Link field, but I don't know how to make the links work from everywhere in the site, because the list of nodes appears on different pages from different paths.

Thanks in advance.

CommentFileSizeAuthor
#28 comment-counter2.gif27.78 KBmikeybusiness
#9 1490680.patch704 bytesdawehner

Comments

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

In general all what views is doing is to use the comment module functionality and display it, i'm wondering whether you have configured 'teaser' on the field?

So it would be cool if you have an export of your view.

jbucks’s picture

Thanks dereine for your reply! I tried looking for I'm not sure what the proper protocol for attaching views exports is, I hope it's OK to post it to this comment like I've done, many apologies if not:

$view = new view;
$view->name = 'farm_updates';
$view->description = 'Returns all Farm Updates';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Farm updates';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'What\'s new';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '5';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['expose']['items_per_page_options_all'] = 0;
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Relationship: Content: Author */
$handler->display->display_options['relationships']['uid']['id'] = 'uid';
$handler->display->display_options['relationships']['uid']['table'] = 'node';
$handler->display->display_options['relationships']['uid']['field'] = 'uid';
/* Field: Content: Body */
$handler->display->display_options['fields']['body']['id'] = 'body';
$handler->display->display_options['fields']['body']['table'] = 'field_data_body';
$handler->display->display_options['fields']['body']['field'] = 'body';
$handler->display->display_options['fields']['body']['label'] = '';
$handler->display->display_options['fields']['body']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['body']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['body']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['body']['alter']['external'] = 0;
$handler->display->display_options['fields']['body']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['body']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['body']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['body']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['body']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['body']['alter']['trim'] = 0;
$handler->display->display_options['fields']['body']['alter']['html'] = 0;
$handler->display->display_options['fields']['body']['element_class'] = 'farm_update_body';
$handler->display->display_options['fields']['body']['element_label_colon'] = 0;
$handler->display->display_options['fields']['body']['element_default_classes'] = 0;
$handler->display->display_options['fields']['body']['empty'] = 'There are currently no updates!';
$handler->display->display_options['fields']['body']['hide_empty'] = 0;
$handler->display->display_options['fields']['body']['empty_zero'] = 0;
$handler->display->display_options['fields']['body']['field_api_classes'] = 0;
/* Field: User: Name */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'users';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['relationship'] = 'uid';
$handler->display->display_options['fields']['name']['label'] = '';
$handler->display->display_options['fields']['name']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['name']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['name']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['name']['alter']['external'] = 0;
$handler->display->display_options['fields']['name']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['name']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['name']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['name']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['name']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['name']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['name']['alter']['trim'] = 0;
$handler->display->display_options['fields']['name']['alter']['html'] = 0;
$handler->display->display_options['fields']['name']['element_type'] = 'span';
$handler->display->display_options['fields']['name']['element_class'] = 'farm_update_posted_label';
$handler->display->display_options['fields']['name']['element_label_type'] = 'span';
$handler->display->display_options['fields']['name']['element_label_class'] = 'farm_update_posted_field';
$handler->display->display_options['fields']['name']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['name']['element_default_classes'] = 0;
$handler->display->display_options['fields']['name']['hide_empty'] = 0;
$handler->display->display_options['fields']['name']['empty_zero'] = 0;
$handler->display->display_options['fields']['name']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['name']['link_to_user'] = 0;
$handler->display->display_options['fields']['name']['overwrite_anonymous'] = 0;
$handler->display->display_options['fields']['name']['format_username'] = 1;
/* Field: Content: Post date */
$handler->display->display_options['fields']['created']['id'] = 'created';
$handler->display->display_options['fields']['created']['table'] = 'node';
$handler->display->display_options['fields']['created']['field'] = 'created';
$handler->display->display_options['fields']['created']['label'] = '';
$handler->display->display_options['fields']['created']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['created']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['created']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['created']['alter']['external'] = 0;
$handler->display->display_options['fields']['created']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['created']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['created']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['created']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['created']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['created']['alter']['trim'] = 0;
$handler->display->display_options['fields']['created']['alter']['html'] = 0;
$handler->display->display_options['fields']['created']['element_type'] = 'span';
$handler->display->display_options['fields']['created']['element_class'] = 'farm_update_post_date';
$handler->display->display_options['fields']['created']['element_label_colon'] = 0;
$handler->display->display_options['fields']['created']['element_default_classes'] = 0;
$handler->display->display_options['fields']['created']['hide_empty'] = 0;
$handler->display->display_options['fields']['created']['empty_zero'] = 0;
$handler->display->display_options['fields']['created']['date_format'] = 'time ago';
/* Field: Content: Belongs to project */
$handler->display->display_options['fields']['field_update_project']['id'] = 'field_update_project';
$handler->display->display_options['fields']['field_update_project']['table'] = 'field_data_field_update_project';
$handler->display->display_options['fields']['field_update_project']['field'] = 'field_update_project';
$handler->display->display_options['fields']['field_update_project']['label'] = '';
$handler->display->display_options['fields']['field_update_project']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['external'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['field_update_project']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['field_update_project']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['trim'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['html'] = 0;
$handler->display->display_options['fields']['field_update_project']['element_type'] = 'div';
$handler->display->display_options['fields']['field_update_project']['element_class'] = 'farm_update_post_date';
$handler->display->display_options['fields']['field_update_project']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_update_project']['element_default_classes'] = 1;
$handler->display->display_options['fields']['field_update_project']['hide_empty'] = 0;
$handler->display->display_options['fields']['field_update_project']['empty_zero'] = 0;
$handler->display->display_options['fields']['field_update_project']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['field_update_project']['field_api_classes'] = 0;
/* Field: Global: Custom text */
$handler->display->display_options['fields']['nothing']['id'] = 'nothing';
$handler->display->display_options['fields']['nothing']['table'] = 'views';
$handler->display->display_options['fields']['nothing']['field'] = 'nothing';
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'farm_update' => 'farm_update',
);

/* Display: Main */
$handler = $view->new_display('panel_pane', 'Main', 'panel_pane_1');
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['expose']['items_per_page_options_all'] = 0;
$handler->display->display_options['defaults']['fields'] = FALSE;
/* Field: Content: Body */
$handler->display->display_options['fields']['body']['id'] = 'body';
$handler->display->display_options['fields']['body']['table'] = 'field_data_body';
$handler->display->display_options['fields']['body']['field'] = 'body';
$handler->display->display_options['fields']['body']['label'] = '';
$handler->display->display_options['fields']['body']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['body']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['body']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['body']['alter']['external'] = 0;
$handler->display->display_options['fields']['body']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['body']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['body']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['body']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['body']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['body']['alter']['trim'] = 0;
$handler->display->display_options['fields']['body']['alter']['html'] = 0;
$handler->display->display_options['fields']['body']['element_class'] = 'farm_update_body';
$handler->display->display_options['fields']['body']['element_label_colon'] = 0;
$handler->display->display_options['fields']['body']['element_default_classes'] = 0;
$handler->display->display_options['fields']['body']['empty'] = 'There are currently no updates!';
$handler->display->display_options['fields']['body']['hide_empty'] = 0;
$handler->display->display_options['fields']['body']['empty_zero'] = 0;
$handler->display->display_options['fields']['body']['field_api_classes'] = 0;
/* Field: User: Name */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'users';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['relationship'] = 'uid';
$handler->display->display_options['fields']['name']['label'] = '';
$handler->display->display_options['fields']['name']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['name']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['name']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['name']['alter']['external'] = 0;
$handler->display->display_options['fields']['name']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['name']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['name']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['name']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['name']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['name']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['name']['alter']['trim'] = 0;
$handler->display->display_options['fields']['name']['alter']['html'] = 0;
$handler->display->display_options['fields']['name']['element_type'] = 'span';
$handler->display->display_options['fields']['name']['element_class'] = 'farm_update_posted_label';
$handler->display->display_options['fields']['name']['element_label_type'] = 'span';
$handler->display->display_options['fields']['name']['element_label_class'] = 'farm_update_posted_field';
$handler->display->display_options['fields']['name']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['name']['element_default_classes'] = 0;
$handler->display->display_options['fields']['name']['hide_empty'] = 0;
$handler->display->display_options['fields']['name']['empty_zero'] = 0;
$handler->display->display_options['fields']['name']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['name']['link_to_user'] = 0;
$handler->display->display_options['fields']['name']['overwrite_anonymous'] = 0;
$handler->display->display_options['fields']['name']['format_username'] = 1;
/* Field: Content: Post date */
$handler->display->display_options['fields']['created']['id'] = 'created';
$handler->display->display_options['fields']['created']['table'] = 'node';
$handler->display->display_options['fields']['created']['field'] = 'created';
$handler->display->display_options['fields']['created']['label'] = '';
$handler->display->display_options['fields']['created']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['created']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['created']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['created']['alter']['external'] = 0;
$handler->display->display_options['fields']['created']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['created']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['created']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['created']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['created']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['created']['alter']['more_link'] = 0;
$handler->display->display_options['fields']['created']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['created']['alter']['trim'] = 0;
$handler->display->display_options['fields']['created']['alter']['html'] = 0;
$handler->display->display_options['fields']['created']['element_type'] = 'span';
$handler->display->display_options['fields']['created']['element_class'] = 'farm_update_post_date';
$handler->display->display_options['fields']['created']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['created']['element_default_classes'] = 0;
$handler->display->display_options['fields']['created']['hide_empty'] = 0;
$handler->display->display_options['fields']['created']['empty_zero'] = 0;
$handler->display->display_options['fields']['created']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['created']['date_format'] = 'time ago';
/* Field: Content: Belongs to project */
$handler->display->display_options['fields']['field_update_project']['id'] = 'field_update_project';
$handler->display->display_options['fields']['field_update_project']['table'] = 'field_data_field_update_project';
$handler->display->display_options['fields']['field_update_project']['field'] = 'field_update_project';
$handler->display->display_options['fields']['field_update_project']['label'] = '';
$handler->display->display_options['fields']['field_update_project']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['external'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['field_update_project']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['field_update_project']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['trim'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['html'] = 0;
$handler->display->display_options['fields']['field_update_project']['element_type'] = 'div';
$handler->display->display_options['fields']['field_update_project']['element_class'] = 'farm_update_post_date';
$handler->display->display_options['fields']['field_update_project']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_update_project']['element_default_classes'] = 1;
$handler->display->display_options['fields']['field_update_project']['hide_empty'] = 0;
$handler->display->display_options['fields']['field_update_project']['empty_zero'] = 0;
$handler->display->display_options['fields']['field_update_project']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['field_update_project']['field_api_classes'] = 0;
/* Field: Global: Custom text */
$handler->display->display_options['fields']['nothing']['id'] = 'nothing';
$handler->display->display_options['fields']['nothing']['table'] = 'views';
$handler->display->display_options['fields']['nothing']['field'] = 'nothing';
$handler->display->display_options['fields']['nothing']['label'] = '';
$handler->display->display_options['fields']['nothing']['alter']['text'] = '<br>';
$handler->display->display_options['fields']['nothing']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['nothing']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['nothing']['alter']['external'] = 0;
$handler->display->display_options['fields']['nothing']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['nothing']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['nothing']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['nothing']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['nothing']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['nothing']['alter']['more_link'] = 0;
$handler->display->display_options['fields']['nothing']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['nothing']['alter']['trim'] = 0;
$handler->display->display_options['fields']['nothing']['alter']['html'] = 0;
$handler->display->display_options['fields']['nothing']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['nothing']['element_default_classes'] = 1;
$handler->display->display_options['fields']['nothing']['hide_empty'] = 0;
$handler->display->display_options['fields']['nothing']['empty_zero'] = 0;
$handler->display->display_options['fields']['nothing']['hide_alter_empty'] = 0;
/* Field: Content: Add comment link */
$handler->display->display_options['fields']['comments_link']['id'] = 'comments_link';
$handler->display->display_options['fields']['comments_link']['table'] = 'node';
$handler->display->display_options['fields']['comments_link']['field'] = 'comments_link';
$handler->display->display_options['fields']['comments_link']['label'] = '';
$handler->display->display_options['fields']['comments_link']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['comments_link']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['comments_link']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['comments_link']['alter']['external'] = 0;
$handler->display->display_options['fields']['comments_link']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['comments_link']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['comments_link']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['comments_link']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['comments_link']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['comments_link']['alter']['more_link'] = 0;
$handler->display->display_options['fields']['comments_link']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['comments_link']['alter']['trim'] = 0;
$handler->display->display_options['fields']['comments_link']['alter']['html'] = 0;
$handler->display->display_options['fields']['comments_link']['element_class'] = 'form-submit-secondary';
$handler->display->display_options['fields']['comments_link']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['comments_link']['element_default_classes'] = 0;
$handler->display->display_options['fields']['comments_link']['hide_empty'] = 0;
$handler->display->display_options['fields']['comments_link']['empty_zero'] = 0;
$handler->display->display_options['fields']['comments_link']['hide_alter_empty'] = 0;
/* Field: Content: Comment count */
$handler->display->display_options['fields']['comment_count']['id'] = 'comment_count';
$handler->display->display_options['fields']['comment_count']['table'] = 'node_comment_statistics';
$handler->display->display_options['fields']['comment_count']['field'] = 'comment_count';
$handler->display->display_options['fields']['comment_count']['label'] = 'Replies';
$handler->display->display_options['fields']['comment_count']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['comment_count']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['comment_count']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['comment_count']['alter']['external'] = 0;
$handler->display->display_options['fields']['comment_count']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['comment_count']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['comment_count']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['comment_count']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['comment_count']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['comment_count']['alter']['more_link'] = 0;
$handler->display->display_options['fields']['comment_count']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['comment_count']['alter']['trim'] = 0;
$handler->display->display_options['fields']['comment_count']['alter']['html'] = 0;
$handler->display->display_options['fields']['comment_count']['element_class'] = 'update_replies_all';
$handler->display->display_options['fields']['comment_count']['element_label_class'] = 'update_replies_all_label';
$handler->display->display_options['fields']['comment_count']['element_label_colon'] = 1;
$handler->display->display_options['fields']['comment_count']['element_default_classes'] = 1;
$handler->display->display_options['fields']['comment_count']['hide_empty'] = 1;
$handler->display->display_options['fields']['comment_count']['empty_zero'] = 0;
$handler->display->display_options['fields']['comment_count']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['comment_count']['format_plural'] = 0;
/* Field: Content: New comments */
$handler->display->display_options['fields']['new_comments']['id'] = 'new_comments';
$handler->display->display_options['fields']['new_comments']['table'] = 'node';
$handler->display->display_options['fields']['new_comments']['field'] = 'new_comments';
$handler->display->display_options['fields']['new_comments']['label'] = '';
$handler->display->display_options['fields']['new_comments']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['new_comments']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['new_comments']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['new_comments']['alter']['external'] = 0;
$handler->display->display_options['fields']['new_comments']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['new_comments']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['new_comments']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['new_comments']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['new_comments']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['new_comments']['alter']['more_link'] = 0;
$handler->display->display_options['fields']['new_comments']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['new_comments']['alter']['trim'] = 0;
$handler->display->display_options['fields']['new_comments']['alter']['html'] = 0;
$handler->display->display_options['fields']['new_comments']['element_class'] = 'update_replies_new';
$handler->display->display_options['fields']['new_comments']['element_label_class'] = 'update_replies_new_label';
$handler->display->display_options['fields']['new_comments']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['new_comments']['element_default_classes'] = 1;
$handler->display->display_options['fields']['new_comments']['hide_empty'] = 1;
$handler->display->display_options['fields']['new_comments']['empty_zero'] = 0;
$handler->display->display_options['fields']['new_comments']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['new_comments']['format_plural'] = 0;
$handler->display->display_options['fields']['new_comments']['suffix'] = ' new';
$handler->display->display_options['fields']['new_comments']['link_to_comment'] = 1;

/* Display: Single */
$handler = $view->new_display('panel_pane', 'Single', 'panel_pane_2');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['title'] = '<none>';
$handler->display->display_options['defaults']['css_class'] = FALSE;
$handler->display->display_options['css_class'] = 'update_in_main_col';
$handler->display->display_options['defaults']['footer'] = FALSE;
/* Footer: Global: Text area */
$handler->display->display_options['footer']['area']['id'] = 'area';
$handler->display->display_options['footer']['area']['table'] = 'views';
$handler->display->display_options['footer']['area']['field'] = 'area';
$handler->display->display_options['footer']['area']['empty'] = FALSE;
$handler->display->display_options['footer']['area']['content'] = '<?php echo l(t(\'My Farm\'), \'my_farm\', array(\'attributes\' => array(\'class\' => array(\'form-submit-secondary\')))); ?>';
$handler->display->display_options['footer']['area']['format'] = 'php_code';
$handler->display->display_options['footer']['area']['tokenize'] = 0;
$handler->display->display_options['defaults']['fields'] = FALSE;
/* Field: Content: Body */
$handler->display->display_options['fields']['body']['id'] = 'body';
$handler->display->display_options['fields']['body']['table'] = 'field_data_body';
$handler->display->display_options['fields']['body']['field'] = 'body';
$handler->display->display_options['fields']['body']['label'] = '';
$handler->display->display_options['fields']['body']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['body']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['body']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['body']['alter']['external'] = 0;
$handler->display->display_options['fields']['body']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['body']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['body']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['body']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['body']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['body']['alter']['trim'] = 0;
$handler->display->display_options['fields']['body']['alter']['html'] = 0;
$handler->display->display_options['fields']['body']['element_class'] = 'farm_update_body';
$handler->display->display_options['fields']['body']['element_label_colon'] = 0;
$handler->display->display_options['fields']['body']['element_default_classes'] = 0;
$handler->display->display_options['fields']['body']['empty'] = 'There are currently no updates!';
$handler->display->display_options['fields']['body']['hide_empty'] = 0;
$handler->display->display_options['fields']['body']['empty_zero'] = 0;
$handler->display->display_options['fields']['body']['field_api_classes'] = 0;
/* Field: User: Name */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'users';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['relationship'] = 'uid';
$handler->display->display_options['fields']['name']['label'] = '';
$handler->display->display_options['fields']['name']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['name']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['name']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['name']['alter']['external'] = 0;
$handler->display->display_options['fields']['name']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['name']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['name']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['name']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['name']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['name']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['name']['alter']['trim'] = 0;
$handler->display->display_options['fields']['name']['alter']['html'] = 0;
$handler->display->display_options['fields']['name']['element_type'] = 'span';
$handler->display->display_options['fields']['name']['element_class'] = 'farm_update_posted_label';
$handler->display->display_options['fields']['name']['element_label_type'] = 'span';
$handler->display->display_options['fields']['name']['element_label_class'] = 'farm_update_posted_field';
$handler->display->display_options['fields']['name']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['name']['element_default_classes'] = 0;
$handler->display->display_options['fields']['name']['hide_empty'] = 0;
$handler->display->display_options['fields']['name']['empty_zero'] = 0;
$handler->display->display_options['fields']['name']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['name']['link_to_user'] = 0;
$handler->display->display_options['fields']['name']['overwrite_anonymous'] = 0;
$handler->display->display_options['fields']['name']['format_username'] = 1;
/* Field: Content: Post date */
$handler->display->display_options['fields']['created']['id'] = 'created';
$handler->display->display_options['fields']['created']['table'] = 'node';
$handler->display->display_options['fields']['created']['field'] = 'created';
$handler->display->display_options['fields']['created']['label'] = '';
$handler->display->display_options['fields']['created']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['created']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['created']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['created']['alter']['external'] = 0;
$handler->display->display_options['fields']['created']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['created']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['created']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['created']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['created']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['created']['alter']['trim'] = 0;
$handler->display->display_options['fields']['created']['alter']['html'] = 0;
$handler->display->display_options['fields']['created']['element_type'] = 'span';
$handler->display->display_options['fields']['created']['element_class'] = 'farm_update_post_date';
$handler->display->display_options['fields']['created']['element_label_colon'] = 0;
$handler->display->display_options['fields']['created']['element_default_classes'] = 0;
$handler->display->display_options['fields']['created']['hide_empty'] = 0;
$handler->display->display_options['fields']['created']['empty_zero'] = 0;
$handler->display->display_options['fields']['created']['date_format'] = 'time ago';
/* Field: Content: Belongs to project */
$handler->display->display_options['fields']['field_update_project']['id'] = 'field_update_project';
$handler->display->display_options['fields']['field_update_project']['table'] = 'field_data_field_update_project';
$handler->display->display_options['fields']['field_update_project']['field'] = 'field_update_project';
$handler->display->display_options['fields']['field_update_project']['label'] = '';
$handler->display->display_options['fields']['field_update_project']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['external'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['field_update_project']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['field_update_project']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['trim'] = 0;
$handler->display->display_options['fields']['field_update_project']['alter']['html'] = 0;
$handler->display->display_options['fields']['field_update_project']['element_type'] = 'div';
$handler->display->display_options['fields']['field_update_project']['element_class'] = 'form-submit-secondary';
$handler->display->display_options['fields']['field_update_project']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_update_project']['element_default_classes'] = 0;
$handler->display->display_options['fields']['field_update_project']['hide_empty'] = 1;
$handler->display->display_options['fields']['field_update_project']['empty_zero'] = 0;
$handler->display->display_options['fields']['field_update_project']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['field_update_project']['field_api_classes'] = 0;
$handler->display->display_options['defaults']['arguments'] = FALSE;
/* Contextual filter: Content: Nid */
$handler->display->display_options['arguments']['nid']['id'] = 'nid';
$handler->display->display_options['arguments']['nid']['table'] = 'node';
$handler->display->display_options['arguments']['nid']['field'] = 'nid';
$handler->display->display_options['arguments']['nid']['default_action'] = 'default';
$handler->display->display_options['arguments']['nid']['default_argument_type'] = 'node';
$handler->display->display_options['arguments']['nid']['default_argument_skip_url'] = 0;
$handler->display->display_options['arguments']['nid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['nid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['nid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['nid']['break_phrase'] = 0;
$handler->display->display_options['arguments']['nid']['not'] = 0;
$translatables['farm_updates'] = array(
  t('Master'),
  t('What\'s new'),
  t('more'),
  t('Apply'),
  t('Reset'),
  t('Sort by'),
  t('Asc'),
  t('Desc'),
  t('Items per page'),
  t('- All -'),
  t('Offset'),
  t('author'),
  t('There are currently no updates!'),
  t('Custom text'),
  t('Main'),
  t('<br>'),
  t('Replies'),
  t('.'),
  t(','),
  t(' new'),
  t('View panes'),
  t('Single'),
  t('<none>'),
  t('<?php echo l(t(\'My Farm\'), \'my_farm\', array(\'attributes\' => array(\'class\' => array(\'form-submit-secondary\')))); ?>'),
  t('All'),
);
jbucks’s picture

Status: Postponed (maintainer needs more info) » Active

I just tried with a fresh Drupal install (no changes to comment settings from the defaults). Steps to reproduce:

- Make a custom content type,
- Make a page view to return nodes of that type,
- Add a field Content: Add Comment Link
- Go to the page view.

If your nodes have no comments, then the link to add comments does not display.

Shouldn't the add comment link always display regardless of comments or not?

tlash’s picture

i see the same issue. did you find a solution?

samlarsen1’s picture

I am also looking for a solution to this

martins.bertins’s picture

This problem is not related with Views. I looked into this myself and found out that it is defined in the core (comment.module line 678) that the "Add new comment" link is shown when there is at least one comment or the comment form is in a separate page.

alex_shapka’s picture

Category: support » bug
Priority: Normal » Major

Martin,

Apparently you wanted to say:

This problem is not related with Views. I looked into this myself and found out that it is defined in the core (comment.module line 678) that the "Add comment" link is shown when there is at least one comment or the comment form is in a separate page.

That's right, but then Views module should provide "Add new comment" field option, which would complicate things, since users would have to deal with two different "add comment" fields. So the best way would be if Views could make a check:

if a node has a comment then provide "Add comment" option
if a node does not have any comment yet, then provide "Add new comment" option

And I believe this is a bug rather than feature request, since Views should be able to provide everything that normal Drupal teaser does.

pixelsticks’s picture

I'm having the same issue and it's definitely slowing me down. Does anyone have a workaround they're using?

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new704 bytes

You know there is already an option for that "show teaser-style link", though it's hidden in the more section.

Let's move that out, because it's a really important setting on this handler.

dawehner’s picture

You know there is already an option for that "show teaser-style link", though it's hidden in the more section.

Let's move that out, because it's a really important setting on this handler.

tim.plunkett’s picture

Version: 7.x-3.3 » 7.x-3.x-dev
Priority: Major » Normal
Status: Needs review » Reviewed & tested by the community

I agree.

dawehner’s picture

Status: Reviewed & tested by the community » Fixed

Awesome thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

fraweg’s picture

Hello,

have someone test the patch from "#9" ? Does it work?

Best regards
Frank

klokie’s picture

Status: Closed (fixed) » Active

Hi, the patch in #9 worked (I'm using views-7.x-3.5 which includes it), but the "Add comment link" field doesn't seem to allow rewriting. I'd like the link text to read "Comment" rather than "Add new comment", but that doesn't work. Is it fixed in 7.x-3.x-dev? Thanks

mollybt’s picture

This was still an issue for me using views 7.x-3.5 . Here is a workaround in views:

Add a new field - Content: path
Exclude it from display

Add a new field - Global: Custom text

Then you write your link to add a comment:

<a href="[path]#comment-form">Add new comment</a>

Vemma-1’s picture

So, how do we post the "Add New Comment" in all postings if there is no comments added? Would love to see the "Add New Comment" link appear regardless if there is no comment added. Wondering if I should delete the line mentioned above on the comment.module file. This same line still exist after a year or more from comment #6.

Vemma-1’s picture

#16
Posted by mollybt on January 18, 2013 at 6:17pm

This was still an issue for me using views 7.x-3.5 . Here is a workaround in views:

Add a new field - Content: path
Exclude it from display

Add a new field - Global: Custom text

Then you write your link to add a comment:

Add new comment

~~@~~@~~

After using from #16, I can see it in the Preview but not in the postings that are all on the front page as full content. Any ideas why this is not working if I can see it in the Previews? thank you mollybt!

schifazl’s picture

Issue summary: View changes

Subscribing to this!

samwilson’s picture

Thanks for that idea @Vemma (#19 above), that works for me.

The Custom text should be:

<a href="[node]#comment-form">Add a comment</a>

kopeboy’s picture

Priority: Normal » Major

What if I am displaying a Rendered Entity: Teaser and not fields?

MatthijsG’s picture

This is in 2016 still an issue with Views 7.x-3.13 ...

The solution in #16 works for me, however i didn't add a custom text but rewrite it in the rewrite-section already (not sure what the exact English translation is).
Add the field node:path (or is it content:path? Again .. language isn't English..)
Check 'rewrite output of this field' under 'rewrite results'. Add something like
Your text
Check 'field as link' and leave the linkpath empty.

Slightly related, but offtopic ;-)
If you want to view the latest comment author, it shows with 0 comments the node author.
Add the field [last comment author] + [comment-count]. Hide the first one, rewrite the second one with [last comment author].
And .. hide [comment count] 'if empty', also when zero (2! checkboxes under rewrite)

rahul patidar’s picture

Hi every one

'Add comment link' doesn't show when they are no comments on a node

I also faced this problem and I think that this is not related to view nor the patches are required. It's actually the content type setting, at least for my case. To solve this go to Admin > Structure > Content type here edit you content type. At the bottom on content type edit form you will see 'Comment settings' tab click it and uncheck the 'Show reply form on the same page as comments' checkbox. This did for me and hope you are looking for this.

Cheers!

Manoj Raj.R’s picture

#16 Worked for me

Thanks @mollybt

buzzbee’s picture

We are running Drupal 8.4.5 and are still having the same issue: the "add comment" link is not displayed when there are no comments AND the box next to "show replies on same page.." is un-ticked. I am sure I have missed something as this has been a problem for how many years? Could you please point me to it?

mikeybusiness’s picture

StatusFileSize
new27.78 KB

It isn't views. #6 martins.bertins noted that it's the comment.module in core around line 679 in Drupal 7. If not empty is one of the conditions for showing the link.

Don't hack core by removing the comment count check.
"!empty($node->commnet_count) && "

Comment Count Check

There may be a better place to put this but this is where google is sending people.

alternativo’s picture

I faced the same problem in D8.7.8
I have users with comment field, and a view of comments...did not shot add comment form if there was no comments done.
Solved making a view of users, showing comment field and filtered with contextual filter with user id.

paulocs’s picture

@alternativo
can you write the steps to reproduce in drupal 8/9 in this issue https://www.drupal.org/project/drupal/issues/2965450?

damienmckenna’s picture

Status: Active » Fixed

Putting this back to "fixed", please continue further discussions in the core issue referenced above. Thank you.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.