Consider the following scenario:

1. Build out site with comments enabled on content types, and add content
2. Build a view over a content type w/ a page display. Configure the Row Style to be Content.
3. For the display settings, check Display Comments
4. Make sure view works.
5. Disable comments
6. Browse to the URL for the page display you made in step 2.

You should either be looking at a error message

Fatal error: Call to undefined function comment_node_page_additions() in /var/www/XXX/docroot/sites/all/modules/views/modules/node.views.inc on line 719

or a WSOD if PHP errors are off.

The problem is that some comment support is baked into Views in the node handlers w/o proper detection of whether comment.module is enabled.

Forgive me if this is a dup, but I didn't find one.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mpdonadio’s picture

Here is a quick patch that checks to see if comment.module is enabled. It

1. Sets the #access on the Display comments checkbox in the display mode settings if it is disabled.
2. Checks whether comment.module is enabled before adding them to the $vars for rendering.

I do not know if this needs to also be done to Drupal 8, as comments are now fields, which means the setting is gone and you can't disable comments if there is field data.

mpdonadio’s picture

Status: Active » Needs review

Forgot to set status.

xjm’s picture

I tested the following steps in D8:

  1. Install Standard.
  2. Create two articles, Foo and Bar.
  3. Post several comments on Foo and Bar.
  4. Switch frontpage view row style display to "Default" instead of "Teaser" (this displays nodes with the full comment thread on the frontpage view).
  5. Delete the comment field from the article bundle.
  6. Run cron to purge the field data.
  7. Visit the front page. All is well.

So this bug (or anything like it) doesn't exist in D8, at least for the full node row style. :) I didn't test a view with comment fields and a field row style.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/modules/node.views.inc
@@ -715,7 +715,7 @@ function node_row_node_view_preprocess_node(&$vars) {
-  if (!empty($options['comments']) && user_access('access comments') && $node->comment) {
+  if (module_exists('comments') && !empty($options['comments']) && user_access('access comments') && $node->comment) {

So yeah this bug probably just appeared if you are an admin, because otherwise user_access() would have failed.

colan’s picture

We've recently switched our testing from the old qa.drupal.org to DrupalCI. Because of a bug in the new system, #2623840: Views (D7) patches not being tested, older patches must be re-uploaded. On re-uploading the patch, please set the status to "Needs Review" so that the test bot will add it to its queue.

If all tests pass, change the Status back to "Reviewed & tested by the community". We'll most likely commit the patch immediately without having to go through another round of peer review.

We apologize for the trouble, and appreciate your patience.

mpdonadio’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
1.61 KB

Same patch as #1, just reuploaded.

mpdonadio’s picture

Status: Needs review » Reviewed & tested by the community

#6 is green, so per #5, setting back to RTBC (which was set in #4).

DamienMcKenna’s picture

Looks good.

DamienMcKenna’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

Status: Fixed » Closed (fixed)

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

fairrandir’s picture

Just to mention: module is named "comment", not "comments".