drupaldrupal-comments

Custom comment form in CCK template


Pre-abmle: I am using MakeMeeting module to create/display meeting polls. This module has its own Content Type and I can't get comments to show on the screen (whether I choose to show comments or on same page or not in Comment Settings for this node type). The MakeMeeting module has it's own theme functions, but perhaps they're not guilty since Drupal must add comments to whichever data is produces by a module, as far as I know.

This brings up two related questions:

1) How can one use custom code to get comment functionality show up on custom CKK node? Most probably be this code should be added to node-typename.tpl.php

2) How can I debug why comments are not displayed, where should I check (function calls, variable names etc).

Thanks!


Solution

  • Comments are handled several places. Most importantly is probably the node template file, and the template.php file. So if comments for a node is not showing up (but is for other node types), there is a limited amount on places where things can go wrong.

    1. The most important place to go look would probably be the template file that is used when the node is displayed. But if this is the same as for the other node types in your site, and the comments are displayed there, this cannot be a problem
    2. After that, I would go to your template.php file, and look at preprocess_node function. Here the theme can do it's own logic to determine if the comments should be presented or not.
    3. A third option, could be if your theme has implemented it's own theme function of theme function used for the comments. I think it's theme_comment_view() that's used.

    I looked through the code for the module, and it doesn't seem like it can be the cause of this problem. However, you might not be viewing an actual node when you think you do. This is the most likely reason. That you are viewing a page that is generated by the module instead of viewing the node itself. This could explain the problem, as you just see what the module has defined. A solution to this, would be to include the node comments in the template file used. I saw that the module implements a lot of template files, so you can take a copy of the one you need to alter, and add in some code in there, that prints the comments. You might need to use some code in a preprocess function (in template.php), to get the actual themed version of the comments, that you can print in your template file.

    Anyways, these are just a lot of suggestions, or guesses, but I can't know if any of this will help. But these are the things where I would start to look.