The function comment_node_search_result (https://api.drupal.org/api/drupal/modules%21comment%21comment.module/fun...) never returns zero (or no string) when node comments are open.

In my opinion the last IF clause of the function should include an AND operator instead of an OR operator. How do you see it?

Thanks

Fèlix

Comments

vimalgoradiya’s picture

In this "if ($node->comment != COMMENT_NODE_CLOSED || $comments > 0)" condition first he has check for comment is closed if comment is closed for the node no need to execute return function. While in second condition he has check for value is greater than 0 means return function need to execute. Second condition need to be true for the comment count. If both condition will mandatory return function never executed.

fcasanellas’s picture

Issue summary: View changes

The problem is with nodes with open comments but zero comments at the moment.
In these cases first condition is true and the return function return array('comment' => format_plural($comments, '1 comment', '@count comments')); returns "1 comment"

fcasanellas’s picture

Issue summary: View changes
vimalgoradiya’s picture

For this you need to refund format_plural function in api.drupal.org. format_plural function ensures that the string is pluralized correctly it formats a string containing a count of items. Otherwise return 1 comment.