I have a content view with a filter for one content type. I tried to add comments to the View by configuring in Views UI Format -> show -> content -> full content -> show comments.

Here is the markup:

I think what is important is the first character -- it is '1' not '<'. I walked through all my preprocess functions and templates and everything seems to be in order. Also, comments render correctly when not built in a View.

"1div id=\"comments\" class=\"comment-wrapper\">\n          <h2 class=\"title\">Comments</h2>\n      \n  <a id=\"comment-212\"></a>\n<article about=\"/cruzr/comment/212#comment-212\" typeof=\"sioc:Post sioct:Comment\" class=\"comment comment-by-node-author comment-by-viewer clearfix clearfix\">\n\n  \n  <footer class='node-submitted clear-block'>\n    <div class='user-picture'>  <div class=\"user-picture\">\n    <a href=\"/cruzr/users/admin\" title=\"View user profile.\"><img typeof=\"foaf:Image\" src=\"http://localhost/cruzr/sites/default/files/styles/user-s/public/pictures/picture-1-1306596694.jpg\" alt=\"admin&#039;s picture\" title=\"admin&#039;s picture\" /></a>  </div>\n</div>\n    <div class='byline'><span rel=\"sioc:has_creator\"><a href=\"/cruzr/users/admin\" title=\"View user profile.\" class=\"username\" xml:lang=\"\" about=\"/cruzr/users/admin\" typeof=\"sioc:UserAccount\" property=\"foaf:name\">admin</a></span></div>\n    <div class='date'>3:07pm Today</div>\n  </footer>\n\n  <header class=\"title clearfix\">\n        <a href=\"/cruzr/comment/212#comment-212\" class=\"permalink\" rel=\"bookmark\">#1</a>                  <em class=\"unpublished\"></em>\n        \n    \n  </header>\n\n  <div>\n    <span rel=\"sioc:reply_of\" resource=\"/cruzr/content/review-bard-design-group-inc-admin-0\" class=\"rdf-meta\"></span><div class=\"field field-name-comment-body field-type-text-long field-label-hidden\"><div class=\"field-items\"><div class=\"field-item even\" property=\"content:encoded\"><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>\n</div></div></div>  </div>\n\n  \n      <nav class=\"links comment-links clearfix\"><ul class=\"links inline\"><li class=\"comment-delete first\"><a href=\"/cruzr/comment/212/delete\">delete</a></li><li class=\"comment-edit\"><a href=\"/cruzr/comment/212/edit\">edit</a></li><li class=\"comment-reply last\"><a href=\"/cruzr/comment/reply/212/212\">reply</a></li></ul></nav>\n  \n</article>\n<a id=\"comment-213\"></a>\n<article about=\"/cruzr/comment/213#comment-213\" typeof=\"sioc:Post sioct:Comment\" class=\"comment comment-by-node-author comment-by-viewer clearfix clearfix\">\n\n  \n  <footer class='node-submitted clear-block'>\n    <div class='user-picture'>  <div class=\"user-picture\">\n    <a href=\"/cruzr/users/admin\" title=\"View user profile.\"><img typeof=\"foaf:Image\" src=\"http://localhost/cruzr/sites/default/files/styles/user-s/public/pictures/picture-1-1306596694.jpg\" alt=\"admin&#039;s picture\" title=\"admin&#039;s picture\" /></a>  </div>\n</div>\n    <div class='byline'><span rel=\"sioc:has_creator\"><a href=\"/cruzr/users/admin\" title=\"View user profile.\" class=\"username\" xml:lang=\"\" about=\"/cruzr/users/admin\" typeof=\"sioc:UserAccount\" property=\"foaf:name\">admin</a></span></div>\n    <div class='date'>3:22pm Today</div>\n  </footer>\n\n  <header class=\"title clearfix\">\n        <a href=\"/cruzr/comment/213#comment-213\" class=\"permalink\" rel=\"bookmark\">#2</a>                  <em class=\"unpublished\"></em>\n        \n    \n  </header>\n\n  <div>\n    <span rel=\"sioc:reply_of\" resource=\"/cruzr/content/review-bard-design-group-inc-admin-0\" class=\"rdf-meta\"></span><div class=\"field field-name-comment-body field-type-text-long field-label-hidden\"><div class=\"field-items\"><div class=\"field-item even\" property=\"content:encoded\"><p>it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>\n</div></div></div>  </div>\n\n  \n      <nav class=\"links comment-links clearfix\"><ul class=\"links inline\"><li class=\"comment-delete first\"><a href=\"/cruzr/comment/213/delete\">delete</a></li><li class=\"comment-edit\"><a href=\"/cruzr/comment/213/edit\">edit</a></li><li class=\"comment-reply last\"><a href=\"/cruzr/comment/reply/212/213\">reply</a></li></ul></nav>\n  \n</article>\n<a id=\"comment-214\"></a>\n<article about=\"/cruzr/comment/214#comment-214\" typeof=\"sioc:Post sioct:Comment\" class=\"comment comment-by-node-author comment-by-viewer clearfix clearfix\">\n\n  \n  <footer class='node-submitted clear-block'>\n    <div class='user-picture'>  <div class=\"user-picture\">\n    <a href=\"/cruzr/users/admin\" title=\"View user profile.\"><img typeof=\"foaf:Image\" src=\"http://localhost/cruzr/sites/default/files/styles/user-s/public/pictures/picture-1-1306596694.jpg\" alt=\"admin&#039;s picture\" title=\"admin&#039;s picture\" /></a>  </div>\n</div>\n    <div class='byline'><span rel=\"sioc:has_creator\"><a href=\"/cruzr/users/admin\" title=\"View user profile.\" class=\"username\" xml:lang=\"\" about=\"/cruzr/users/admin\" typeof=\"sioc:UserAccount\" property=\"foaf:name\">admin</a></span></div>\n    <div class='date'>3:24pm Today</div>\n  </footer>\n\n  <header class=\"title clearfix\">\n        <a href=\"/cruzr/comment/214#comment-214\" class=\"permalink\" rel=\"bookmark\">#3</a>                  <em class=\"unpublished\"></em>\n        \n    \n  </header>\n\n  <div>\n    <span rel=\"sioc:reply_of\" resource=\"/cruzr/content/review-bard-design-group-inc-admin-0\" class=\"rdf-meta\"></span><div class=\"field field-name-comment-body field-type-text-long field-label-hidden\"><div class=\"field-items\"><div class=\"field-item even\" property=\"content:encoded\"><p>zxcvzxcvzxcvzxcv</p>\n</div></div></div>  </div>\n\n  \n      <nav class=\"links comment-links clearfix\"><ul class=\"links inline\"><li class=\"comment-delete first\"><a href=\"/cruzr/comment/214/delete\">delete</a></li><li class=\"comment-edit\"><a href=\"/cruzr/comment/214/edit\">edit</a></li><li class=\"comment-reply last\"><a href=\"/cruzr/comment/reply/212/214\">reply</a></li></ul></nav>\n  \n</article>\n\n  </div>\n"

Comments

Adam S’s picture

StatusFileSize
new480 bytes

Because Views calls drupal_render on the $node->content['comments'] array it can not be worked with in a template file using the hide() function which expects an array while Views has already rendered it as a string. Here is the patch.

Adam S’s picture

Status: Reviewed & tested by the community » Active
  // Prevent the comment form from showing up if this is not a page display.
  if ($vars['view_mode'] == 'full' && !$vars['view']->display_handler->has_path()) {
    $node->comment = FALSE;
  }

This little piece of code just doesn't prevent comment form from showing, it prevents all the comments from showing.

dawehner’s picture

Status: Active » Reviewed & tested by the community

The patch itself looks good.

hnln’s picture

Status: Active » Reviewed & tested by the community

sub

hnln’s picture

and patch seems to work here 2

dawehner’s picture

Status: Reviewed & tested by the community » Fixed

Commited to 7.x-3.x

Status: Fixed » Closed (fixed)

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

ksenzee’s picture

StatusFileSize
new512 bytes

For purely selfish reasons (i.e. drush make) I'm uploading a version of this patch that applies to rc1.

jibran’s picture

Status: Closed (fixed) » Active

In the below view, I am unable to see comments attached to node.

$view = new view;
$view->name = 'articles';
$view->description = 'Articles';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Articles';
$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'] = 'Articles';
$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'] = '10';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
$handler->display->display_options['row_options']['view_mode'] = 'full';
$handler->display->display_options['row_options']['links'] = 1;
$handler->display->display_options['row_options']['comments'] = 1;
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* 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(
  'article' => 'article',
);

/* Display: Block */
$handler = $view->new_display('block', 'Block', 'block');
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '5';

And when I change format to Teaser it shows me comments and comment form.

xanderol’s picture

I'm getting the same thing as #10

The comments will show for teaser but not for full content.

I tried 7.x-3.0 and 7.x-3x-dev

dariogcode’s picture

Same for me. I tried 7.x-3.1+31-dev

dawehner’s picture

StatusFileSize
new3.52 KB

Here is a view which works fine for me both on pages and blocks.

I'm pretty sure you have some kind of overlap of two pagers here. Please setup another pager id for the pager in views, as you can't change the one coming from the comments.

Needs review means that there is a real patch attached, which is not.

jibran’s picture

StatusFileSize
new3.41 KB

I have tested the above view. It works fine if format -> show is Content | Teaser but just change it to Content | Full content and it stop showing comments on block display.

mcfilms’s picture

Was this patch ever rolled into Views 3.x? Currently I have a field View displaying 3 rendered nodes. I also included the field for rendered comments. And finally I set a Relationship of Comment: Comments of the node. (Tried it with and without this relationship.) The comments never seem to display. In fact the only way I have been able to show a comment is to display all the node's fields followed by all the comment's fields.

Is this a known bug or is this pilot error?

dawehner’s picture

@mcfilms
Yes, see http://drupal.org/node/1194614#comment-4640014

 In fact the only way I have been able to show a comment is to display all the node's fields followed by all the comment's fields.

You can do this by displaying comments, choose the relationship to node, and then display both of them.

joshmiller’s picture

Getting bit by this (see Comment #2) on for showing comments on a block within a view. This was added by @merlinofchaos in #1077632: Views blocks that use the "full node" build mode display incorrectly on the node page and I'm going to post a patch that only checks to see if the node in question isn't a menu_get_object() ... which avoids the problem only if it exists.

derekahmedzai’s picture

Is there a fix for this?

Like #14 I can only display comments if the format is Show: Content | Full content

joshmiller’s picture

The patch was posted here: http://drupal.org/node/1077632#comment-6300058

I did talk to merlinofchaos about this and he said my reverting of the code was a bit drastic and might have bigger complications. We run drupalcommerce.org for thousands of users every day and don't have any odd issues.

Josh

Northern_Girl’s picture

I ran in this problem with views 3.8. Is there a turnaround solution for this? Maybe by attaching a view of comments? A relationship? I tried different things but just cannont find a way (just not good enough with views...).

Thanks.

Yuri’s picture

Good question Northern_Girl, Its funny that this issue is still present after three years.

Yuri’s picture

@joshmiller not sure if this has to do with that patch you mentioned in #20. I applied it and comments show up, but The full content view ignores the display settings of the node. For example, I have hidden the title..and it stills shows.

Northern_Girl’s picture

Well... What I did is : " Show: Content | Tokens ".

So I got everything : complete nodes, tags, links to comments and comments. For the final «tweak» I used CSS and "visibility:none" to hide the tags. So I got some sort of guestbook/collective wall. Now I'm looking for a Rules to unpublish "shouts" that are to old...

NG